Skip to Content
Nov 22 at 08:00 AM

DOCREFERENCE creation results in the contract violation exception (TOR)

51 Views Last edit Nov 22 at 08:01 AM 2 rev


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

iv_act_key = /scmtms/if_tor_c=>sc_action-docreference-create_docreference
it_key = lt_fu_key
is_parameters = lr_docref_k
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...


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?