An action is similar to a Function module in ERP that you can use to do stuff for you instead of coding it yourself. But, whereas the FM is generic, an action does a concrete thing and a determination determines something and an association links two nodes. In BOPF, these are all different things. Advantage: you can search for things separately and in a categorized manner. To find one in TM, do the following:
-Use transaction /n/BOBF/CONF_UI
-You get the following screen:
-Double-click on /SCMTMS/TOR
-Open Node elements
-Choose the note to which the action is related
-I am looking for an action that updates the delivery status on the FO root level, thus I choose ROOT
-I am looking for an action, some coding that does something (association is a link between 2 nodes, validation validates something, queries are pre-defined searches, determinations can default data based on other data for example etc ).
-If I double-click on ACTION, I get all the names of actions that exist for the ROOT node of the FU
-Based on the descriptions, I am able to figure out which one could help me
-I find the action determine delivery status as follows:
This is just an example, it may be smarter to update the cargo receipt status on product level and let the standard update the delivery status on the FU when all products were delivered. But, it shows you how to find an action and that was the purpose.
The below coding shows how you can choose the action to set the cargo receipt status based on an EM event (unloading or proof of delivery for example).
data:
lo_srvmgr_tor type ref to /bobf/if_tra_service_manager,
lo_change type ref to /bobf/if_tra_change,
lo_message type ref to /bobf/if_frw_message,
lo_tramgr type ref to /bobf/if_tra_transaction_mgr,
ls_key type /bobf/s_frw_key,
lt_key type /bobf/t_frw_key,
lt_stage_k type /bobf/t_frw_key,
lt_failed_key type /bobf/t_frw_key,
lt_failed_action_key type /bobf/t_frw_key,
lt_return type bapiret2_tab,
lv_rejected type boole_d.
field-symbols:
<ls_key> like line of lt_key,
<ls_rp_sydat> type /saptrx/rp_sydat.
" Init.
clear e_return_code.
clear ls_key.
ls_key-key = /scmtms/cl_tor_helper_root=>return_key_for_torid( iv_torid = i_eai-event_msg-hdr-trxid ).
insert ls_key into table lt_key.
" Declare service manager
lo_srvmgr_tor = /bobf/cl_tra_serv_mgr_factory=>get_service_manager( /scmtms/if_tor_c=>sc_bo_key ).
" Set cargo receipt status to delivered
lo_srvmgr_tor->do_action(
exporting
iv_act_key = /scmtms/if_tor_c=>sc_action-root-set_cargo_receipt_delivered
it_key = lt_key
importing
eo_change = lo_change
eo_message = lo_message
et_failed_key = lt_failed_key
et_failed_action_key = lt_failed_action_key ).
if ( lt_failed_key is not initial or lt_failed_action_key is not initial ) and lo_message is bound.
/scmtms/cl_common_helper=>msg_convert_bopf_2_bapiret2(
exporting
iv_severity = 'E'
io_message = lo_message
changing
ct_bapiret2 = lt_return ).
delete adjacent duplicates from lt_return.
else.
" Save Transaction
lo_tramgr = /bobf/cl_tra_trans_mgr_factory=>get_transaction_manager( ).
call method lo_tramgr->save
importing
eo_message = lo_message
ev_rejected = lv_rejected.
if lv_rejected is not initial and lo_message is bound.
/scmtms/cl_common_helper=>msg_convert_bopf_2_bapiret2(
exporting
iv_severity = 'E'
io_message = lo_message
changing
ct_bapiret2 = lt_return ).
delete adjacent duplicates from lt_return.
endif.
endif.
If you want to know more about it, please refer to the enhancement guide from Holger Polch which explains everything very well and has coding examples.
https://scn.sap.com/blogs/SAP_TM_Enhancements
Regards
Petra
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
2 | |
1 | |
1 | |
1 | |
1 |