Service order description modify and save

简介: Service order description modify and save

Created by Jerry Wang, last modified on Apr 14, 2014

使用wiki末尾的report 通过 bol entity的 set_property 修改一个service order的description,在SAT里面能够看到下列callstack:

image.png

1. 从container proxy拿到attribute property object ( line 16 )


2. 从object model根据attribute name和当前BOL entity的object name拿到attribute index( line 18 )


3. 判断当前待修改的attribute是否满足修改条件: 非read only, 且BOL entity是changeable( line 23 ~ line 24 )


4. 判断当前的attribute value是否等于待修改的新value ( line 25 )


5. 如果bol entity没有上锁,则call lock method ( line 29)


6. 将changed flag置位( line 34 )

image.png

7. 将bol entity的sendable flag置位( line 37 )

8. 在buffer里将attribute设成set_property传入的值( line 40 )

9. 记录change log ( line 43 )

image.png在bol entity manager GET_MODIFIED_ENTITIES里:

image.png

只有在set_property里面调用了activate_sending的entity才会返回.

image.pngimage.pngimage.pngimage.pngimage.pngREPORT  zorder_search_update.


PARAMETERS: id   TYPE crmd_orderadm_h-object_id OBLIGATORY DEFAULT '8000000140',

           type TYPE char4 OBLIGATORY DEFAULT 'SRVO',

           text type char10 OBLIGATORY DEFAULT 'new value'.


DATA: lo_core                TYPE REF TO cl_crm_bol_core,

     lo_collection          TYPE REF TO if_bol_entity_col,

     lv_query_name          TYPE crmt_ext_obj_name,

     lt_selection_parameter TYPE genilt_selection_parameter_tab,

     ls_selection_parameter TYPE genilt_selection_parameter,

     lo_order               TYPE REF TO cl_crm_bol_entity,

     lo_header              TYPE REF TO cl_crm_bol_entity,

     lv_success             TYPE abap_bool,

     lv_changed             TYPE abap_bool,

     ls_query_parameters    TYPE genilt_query_parameters,

     lv_size                TYPE i.


START-OF-SELECTION.


 ls_selection_parameter-attr_name = 'OBJECTID'.

 ls_selection_parameter-option =  'EQ'.

 ls_selection_parameter-sign = 'I'.

 ls_selection_parameter-low =  id.


 APPEND ls_selection_parameter TO lt_selection_parameter.


 ls_selection_parameter-attr_name = 'MAINCATEGORY'.

 ls_selection_parameter-option =  'EQ'.

 ls_selection_parameter-sign = 'I'.

 ls_selection_parameter-low =  type.

 APPEND ls_selection_parameter TO lt_selection_parameter.

 lv_query_name = 'BTAdvQueryAUI'.


 lo_core = cl_crm_bol_core=>get_instance( ).

 lo_core->load_component_set( 'BT' ).


 lo_collection = lo_core->dquery(

         iv_query_name               = lv_query_name

         it_selection_parameters     = lt_selection_parameter

         is_query_parameters         = ls_query_parameters ).


 CHECK lo_collection IS NOT INITIAL.

 lv_size = lo_collection->size( ).

 WRITE: / 'Number of Service Order found: ' , lv_size COLOR COL_POSITIVE.

 CHECK lv_size > 0.

 lo_order = lo_collection->get_first( ).


 lo_header = lo_order->get_related_entity( 'BTOrderHeader' ).


 lo_header->switch_to_change_mode( ).


 lo_header->set_property( iv_attr_name = 'DESCRIPTION' iv_value = text ).


 DATA: lo_transaction TYPE REF TO if_bol_transaction_context.


 lo_transaction = lo_core->get_transaction( ).

 lo_core->modify( ).

 lv_changed = lo_transaction->check_save_needed( ).


 CHECK lv_changed EQ abap_true.

 lv_success = lo_transaction->save( ).

 IF lv_success = abap_true.

   lo_transaction->commit( ).

   WRITE:/ 'Service Order changed Successfully'.

 ELSE.

   lo_transaction->rollback( ).

 ENDIF.


目录
相关文章
|
3月前
|
Java Spring
Description:Field contentMapper in worldtolingyidianke.file.service.impl.ContentServiceImpl requir
Description:Field contentMapper in worldtolingyidianke.file.service.impl.ContentServiceImpl requir
Field userMapper in zero.file.videoProject.service.UserService required a bean of type ‘zero.file.vi
Field userMapper in zero.file.videoProject.service.UserService required a bean of type ‘zero.file.vi
|
5月前
|
存储
Build desc failed:Fetch table group shards failed on meta proxy:Loading cached shard 1ocation value for table group[dwhg_scm.dwhg_prd_tg_default] failed
Build desc failed:Fetch table group shards failed on meta proxy:Loading cached shard 1ocation value for table group[dwhg_scm.dwhg_prd_tg_default] failed
182 2
|
Java 开发工具
gradle Could not create service of type CrossBuildFileHashCache using BuildSessionScopeServices.crea
gradle Could not create service of type CrossBuildFileHashCache using BuildSessionScopeServices.createCrossBuildFileHashCache().
6738 0
在S4 key user tool里创建Custom Logic的后台实现
在S4 key user tool里创建Custom Logic的后台实现
110 0
在S4 key user tool里创建Custom Logic的后台实现
|
存储
One order里user status和system status的mapping逻辑
One order里user status和system status的mapping逻辑
121 0
One order里user status和system status的mapping逻辑
How to create CDS view to return Service order item detail data
You are asked to create a CDS view which must return the following information of Service order line item.
How to create CDS view to return Service order item detail data
How to add a custom UI component to service order overview page
How to add a custom UI component to service order overview page
110 0
How to add a custom UI component to service order overview page