cancel
Showing results for 
Search instead for 
Did you mean: 

Trigger an event with helper class /SCMTMS/CL_TOR_HELPER_EVENT

0 Kudos
3,396

hi,

in Tm embedded function module /SAPTRX/BAPI_EH_ADDEVENTMSG_02 does not exist any more. it was used to raise an event before. I found /SCMTMS/CL_TOR_HELPER_EVENT, method REPORT_EVENT instead, but it is unclear what the mandatory fields are. the below code has no syntax errors, but the event is not raised/visible in the FO.

        "get first location
        lo_srv_tor->retrieve_by_association(
          EXPORTING
                iv_node_key             = /scmtms/if_tor_c=>sc_node-root
                it_key                  = lt_fo_key
                iv_fill_data            = abap_true
                iv_association          = /scmtms/if_tor_c=>sc_association-root-stop_first

          IMPORTING
                eo_message              = lo_message
                et_data                 = lt_stop_first
                et_failed_key           = lt_failed_key ).

        "Move source location into variable
        READ TABLE lt_stop_first ASSIGNING FIELD-SYMBOL(<ls_stop_first>) INDEX 1.
        lv_src_loc = <ls_stop_first>-log_locid.
        lv_first_stop_key = <ls_stop_first>-key.

        APPEND VALUE #( target_key = lv_first_stop_key ) TO lt_first_stop_key.

        "Move today´s date into variable
        CONVERT DATE sy-datum INTO TIME STAMP lv_event_date_time TIME ZONE 'CET'.


        "Set event LOAD_BEGIN
        CALL METHOD /scmtms/cl_tor_helper_event=>report_event
          EXPORTING
            iv_event_code       = 'LOAD_BEGIN'
            iv_ref_event_code   = 'LOAD_BEGIN'
            it_tor_key          = lt_fo_key
            it_tor_root_stop    = lt_first_stop_key
            iv_event_status     = 'R'
*           it_tor_stop_item    =
           " io_modify           = 'X'
            iv_actual_date      = lv_event_date_time
            iv_actual_tz        = 'CET'
            iv_exec_info_source = 'T'
            iv_register_action  = 'X'
          IMPORTING
            et_failed_key       = lt_failed_key
            eo_message          = lo_message.
View Entire Topic
arun_yesodharan
Active Participant
0 Kudos

Hello Petra ,

Did you checked the method - EXTRACT_STANDARD_EVENT, which underlies the /SCMTMS/CL_TOR_HELPER_EVENT. This is similar to the standard FM /SAPTRX/BAPI_EH_ADDEVENTMSG_02. Based on my understanding the following shall be mandatory:

For Tracking Header:

EVTCNT,EVTCOD,TRXCOD,TRXID,EVTDAT,EVTTIM,EVTZON

For Tracking Location:

EVTCNT,LOCID1,LOCOD(if any)

Basically the same values which we require for BAPI shall need to be filled.