on 2022 Nov 22 8:00 AM
Hello,
I am trying to assign a new Document Reference to the Freight Unit using the TOR Actions in the ABAP code. This is the example implementation:
DATA lt_fu_key TYPE /bobf/t_frw_key.
DATA lo_change TYPE REF TO /bobf/if_tra_change.
DATA lo_message TYPE REF TO /bobf/if_frw_message.
DATA lt_failed_key TYPE /bobf/t_frw_key.
DATA lt_failed_action_key TYPE /bobf/t_frw_key.
DATA(lo_srv_tor) = /bobf/cl_tra_serv_mgr_factory=>get_service_manager( /scmtms/if_tor_c=>sc_bo_key ).
DATA(lv_fu_key) = /scmtms/cl_tor_helper_root=>return_key_for_torid( iv_torid = '0000000001' ). " Some FU ID in here
INSERT VALUE /bobf/s_frw_key( key = lv_fu_key ) INTO TABLE lt_fu_key.
DATA(lr_docref_k) = NEW /scmtms/s_tor_docref_k( ).
lr_docref_k->btd_id = 'ZDOC_00_001'.
lr_docref_k->btd_tco = 'ABC'. " Some custom BTD Type
lo_srv_tor->do_action(
EXPORTING
iv_act_key = /scmtms/if_tor_c=>sc_action-docreference-create_docreference
it_key = lt_fu_key
is_parameters = lr_docref_k
IMPORTING
eo_change = lo_change
eo_message = lo_message
et_failed_key = lt_failed_key
et_failed_action_key = lt_failed_action_key ).
" The message handling if there are some returned
The problem is that the execution of this code results in the `/BOBF/CX_FRW_CONTRCT_VIOLATION` exception which occurs in the `/BOBF/IF_TRA_SERVICE_MANAGER~DO_ACTION` method of the `/BOBF/CL_TRA_SERVICE_MGR` class in the place marked below.
METHOD /bobf/if_tra_service_manager~do_action.
DATA: lv_auth_failed TYPE abap_bool.
" contract checks:
ASSERT gv_application_error = abap_false.
contract_parameter_not_initial iv_act_key.
contract_action_is_standard iv_act_key. " The exception occurs HERE
" The rest of the method's code is here...
ENDMETHOD.
The exception's text tells me that the action `CREATE_DOCREFERENCE` is not a standard action. As I am not that familiar with the processes, I am not aware what that can mean and debugging does not say much to be honest.
I should mention that the assignment of the document using the Fiori App works just fine and returns no errors.
Could you please explain me what is the problem and how can I resolve the issue?
Thanks.
Hi Norbert,
you can only call BOBF actions via the service manager which are of type 0 - Object Specific Action.
The others, such as the create_docreference, are generated by the framework and you cannot call them the way you try to do.
You can create the DocRef entries with a simple BOBF modification. Try something like this:
DATA lo_message TYPE REF TO /bobf/if_frw_message.
DATA lt_mod TYPE /bobf/t_frw_modification.
DATA(lo_srv_tor) = /bobf/cl_tra_serv_mgr_factory=>get_service_manager( /scmtms/if_tor_c=>sc_bo_key ).
DATA(lv_fu_key) = /scmtms/cl_tor_helper_root=>return_key_for_torid( iv_torid = '0000000001' ). " Some FU ID in here
DATA(ls_docref_k) = VALUE /scmtms/s_tor_docref_k( btd_id = 'ZDOC_00_001' btd_tco = 'ABC' ).
/scmtms/cl_mod_helper=>mod_create_single(
EXPORTING
is_data = ls_docref_k
iv_parent_key = lv_fu_key
iv_node = /scmtms/if_tor_c=>sc_node-docreference
iv_source_node = /scmtms/if_tor_c=>sc_node-root
iv_association = /scmtms/if_tor_c=>sc_association-root-docreference
CHANGING
ct_mod = lt_mod ).
lo_srv_tor->modify( it_modification = lt_mod ).
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Check this class/method maybe can give you a sample how standard updated with interface class
/SCMTMS/CL_OUTB_MAPPER -->ADD_TOR_DOCREF_TOR_ID
/SCMTMS/CL_OUTB_MAPPER --> FILL_TOR_DOCREF
Regards
Rogerio
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
7 | |
6 | |
3 | |
2 | |
2 | |
1 | |
1 | |
1 | |
1 | |
1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.