Skip to Content
0
Nov 21, 2020 at 11:45 AM

Trigger an event with helper class /SCMTMS/CL_TOR_HELPER_EVENT

1674 Views Last edit Nov 21, 2020 at 12:57 PM 3 rev

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.