Skip to Content

Update actual quantities in SAP TM via event message in SAP EM

In scenarios in which actual quantities are reported via event messages to the corresponding event handlers in SAP EM, it may be a requirement to automatically update the actual quantities in the corresponding freight documents in SAP TM. This document shows how this can be done.

In this example it is assumed that there is a freight order with exactly one container and that event code 'REPORT_QUANTITY' has been defined in SAP EM for reporting actual quantities for this container of the freight order. For this event message parameters have been defined, e.g. for gross weight and the related unit of measurement, with custom event message extension table:

To get the reported actual quantities into SAP TM we can define an extraction profile for these event message parameters (IMG activity "Define Extraction Profiles for SAP TM Freight Document Tracking"). More information regarding the extraction profiles can be found in this document: How to extract additional parameters for the EM – TM integration .

The extraction parameter names have to be the same which are used on node EXECUTIONINFORMATION in SAP TM for the corresponding quantity fields:

This extraction profile can then be used for standard rule set activity TM_MAINTAIN_EXEC_INF:

By this the event message 'REPORT_QUANTITY' will be propagated with the additional parameters for gross weight to the corresponding freight order in SAP TM.

In SAP TM this execution information should be referenced to the container item of the freight order. To achieve this method PROCESS_EVENT of BAdI /SCMTMS/TOR_EVENT_PROC can be implemented. The BAdI should be executed in work mode 'C' (Customer Logic Only - can be set by implementing method /SCMTMS/IF_COMMON_BADI~SET_BADI_WORK_MODE). In method PROCESS_EVENT the container item has to be determined for the 'REPORT_QUANTITY' events and the standard method PROVIDE_CR_UPD_DATA of class /SCMTMS/CL_TOR_EXEC_PROCESS should be called, which could look like this:

In scenarios with multiple items for which actual quantities have to be reported per freight order a solution could be to add an identifier (Item ID, Container ID,...) for the item into the event message and add this parameter as well into the extraction profile. It can then be used inside the BAdI implementation to determine the correct item to which the actual quantities refer to.

Cheers, Daniel


No comments