• UI BOL 练习 get value set attr


    "
    "
    "
    "
    "**********************change list*************************
    "20170302         andylee                for bol test
    "
    "
    "
    "
    REPORT ylytest02.
    
    "data defination
    DATA lr_core TYPE REF TO cl_crm_bol_core.
    DATA:gv_is_started TYPE abap_bool.
    DATA:gv_guid TYPE crmt_object_guid VALUE 'B083FEDE53F91EE6BE9C205CA3BED5E1'."order:8000001091
    DATA:lr_root_entity TYPE REF TO cl_crm_bol_entity.
    DATA:lr_order_h TYPE REF TO cl_crm_bol_entity.
    DATA:ls_order_h TYPE crmst_adminh_btil.
    DATA:lr_textset TYPE REF TO cl_crm_bol_entity.
    DATA:lr_textall TYPE REF TO cl_crm_bol_entity.
    DATA:lr_text    TYPE REF TO if_bol_entity_col.
    DATA:lr_iter    TYPE REF TO if_bol_bo_col_iterator.
    DATA:ls_textall TYPE crmst_text_btil.
    DATA:lv_trans TYPE REF TO if_bol_transaction_context.
    DATA:lv_text TYPE string VALUE 'text'.
    FIELD-SYMBOLS:<text> TYPE any.
    **************************************************activity
    DATA:lr_activity_h TYPE REF TO cl_crm_bol_entity.
    DATA:ls_activity_h TYPE crmst_activityh_btil.
    **************************************************activity
    
    
    
    "get instance
    lr_core = cl_crm_bol_core=>get_instance( ).
    "check the bol instance is initial
    gv_is_started = cl_crm_bol_core=>check_is_started( ).
    
    "if instance is not initial,get initial
    IF gv_is_started EQ abap_false.
      lr_core->start_up( 'BT' ).
    ENDIF.
    "get root entity
    CHECK lr_core IS BOUND.
    
    lr_root_entity = lr_core->get_root_entity(
        iv_object_name = 'BTOrder'
        iv_object_guid = gv_guid ).
    
    CHECK lr_root_entity IS BOUND.
    "get order head entity
    lr_order_h = lr_root_entity->get_related_entity(
        iv_relation_name = 'BTOrderHeader' ).
    
    ******************************长文本处理********************************* begin
    "get order head data
    CHECK lr_order_h IS BOUND.
    lr_order_h->if_bol_bo_property_access~get_properties(
       IMPORTING
         es_attributes = ls_order_h ).
    
    lr_textset = lr_order_h->get_related_entity(
        iv_relation_name = 'BTHeaderTextSet' ).
    
    "get texthall entity
    CHECK lr_textset IS BOUND.
    
    lr_textall = lr_textset->get_related_entity(
        iv_relation_name = 'BTTextHAll' ).
    IF lr_textall IS NOT BOUND.
      "create textall entity
      lr_textall = lr_textset->create_related_entity(
          iv_relation_name = 'BTTextHAll' ).
      IF lr_textall->is_changeable( ) = abap_true.
        lr_textall->if_bol_bo_property_access~get_properties(
         IMPORTING
           es_attributes = ls_textall ).
        ls_textall-tdobject = 'CRM_ORDERH' .
        ls_textall-tdname = gv_guid .
        ls_textall-tdid = 'A002'.
        ls_textall-tdspras = sy-langu .
        lr_textall->if_bol_bo_property_access~set_properties( is_attributes = ls_textall ).
        ASSIGN lv_text TO <text>.
        lr_textall->if_bol_bo_property_access~set_property(
            iv_attr_name = 'CONC_LINES'
            iv_value     = <text> ).
      ENDIF.
    ELSE.
      lr_text = lr_textset->get_related_entities(
        iv_relation_name = 'BTTextHAll' ).
      lr_iter = lr_text->if_bol_bo_col~get_iterator( ).
      IF lr_iter IS BOUND.
        lr_text ?= lr_iter->find_by_property( EXPORTING iv_attr_name = 'TDID' iv_value = 'A002' ).
      ENDIF.
      ASSIGN lv_text TO <text>.
      lr_textall->if_bol_bo_property_access~set_property(
          iv_attr_name = 'CONC_LINES'
          iv_value     = <text> ).
    
    ENDIF.
    ******************************长文本处理*********************************end
    ******************************activity*********************************begin
    lr_activity_h = lr_order_h->get_related_entity(
        iv_relation_name = 'BTHeaderActivityExt' ).
    CHECK lr_activity_h IS BOUND.
    
    lr_activity_h->if_bol_bo_property_access~get_properties(
       IMPORTING
         es_attributes = ls_activity_h ).
    
    WRITE ls_activity_h-priority.
    
    ******************************activity*********************************end
    
    
    "modify core entity all.
    lr_core->modify( ).
    lv_trans = lr_core->get_transaction( ).
    lv_trans->save( ).
    lv_trans->commit( ).
  • 相关阅读:
    窗口宽高 滚动条滚动距离 元素的文档坐标和窗口坐标
    parentNode parentElement childNodes children
    ffmpeg 提取mp3
    Linux修改时区的正确方法
    pip
    wireguard
    Nextcloud挂载谷歌云盘搭建
    ts合并
    screen
    google drive
  • 原文地址:https://www.cnblogs.com/sapSB/p/6491648.html
Copyright © 2020-2023  润新知