Service order description modify and save
Created by Jerry Wang, last modified on Apr 14, 2014
使用wiki末尾的report 通過(guò) bol entity的 set_property 修改一個(gè)service order的description,在SAT里面能夠看到下列callstack:
?
1. 從container proxy拿到attribute property object ( line 16 )
2. 從object model根據(jù)attribute name和當(dāng)前BOL entity的object name拿到attribute index( line 18 )
3. 判斷當(dāng)前待修改的attribute是否滿足修改條件: 非read only, 且BOL entity是changeable( line 23 ~ line 24 )
4. 判斷當(dāng)前的attribute value是否等于待修改的新value ( line 25 )
5. 如果bol entity沒(méi)有上鎖,則call lock method ( line 29)
6. 將changed flag置位( line 34 )
?
7. 將bol entity的sendable flag置位( line 37 )
8. 在buffer里將attribute設(shè)成set_property傳入的值( line 40 )
9. 記錄change log ( line 43 )
?
在bol entity manager GET_MODIFIED_ENTITIES里:
?
只有在set_property里面調(diào)用了activate_sending的entity才會(huì)返回.
?
?
設(shè)置斷點(diǎn):
?
通過(guò)debug的方式能發(fā)現(xiàn)如果通過(guò) set_property修改description,則傳到function module CRM_ORDER_MAINTAIN里的參數(shù)只是order guid + new description value:
?
?
REPORT??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.
總結(jié)
以上是生活随笔為你收集整理的Service order description modify and save的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: 马斯克:推特大多数广告主已回归,8000
- 下一篇: 闪战固态硬盘是哪家的