You are on page 1of 22

Troubleshooting Guide: Integration of SAP TM

and SAP EM – Best practices for root cause


analysis

Applies to:
SAP Transportation Management, SAP Event Management

Summary
This document provides an overview of what can be done if the integration between SAP EM and SAP TM is
not working as expected.
It describes in detail:
• what can be checked when analyzing issues including checks on
- transactional data
- customizing settings
• which monitors and logs are available and how these can be checked and enabled
• how the process can be debugged.

Additionally there is a list of some common root causes of issues which occurred in various projects. The
focus is on the order tracking scenarios, but many of the points are valid for the instruction tracking and
resource tracking scenarios as well.
If issues occur which are related to the integration of SAP TM and SAP EM, the most common symptom is
typically that the data between the two involved systems is no longer consistent. Either:
• an update did not reach SAP EM (calls of /SAPTRX/BAPI_EH_POST or
/SAPTRX/BAPI_EH_ADDEVENTMSG_02 from SAP TM) or
• an update did not reach SAP TM (call of /SCMTMS/EXECINFO_PROCESS triggered by rule set
activity TM_MAINTAIN_EXEC_INF).
This can have multiple root causes. Therefore you typically have to consider several of the checks in this
document to find out what has gone wrong.

Author: Daniel Härder (SAP EM Architect)

Company: SAP SE

Created on: 30.10.2015 Version: 1.1

1
Table of Contents
Check Queues .................................................................................................................................................... 3
Check Short Dumps ............................................................................................................................................ 3
Check TORs and EHs ........................................................................................................................................ 4
Check for locking issues ..................................................................................................................................... 4
Check Customizing in SAP TM........................................................................................................................... 5
TOR Types Settings ........................................................................................................................................ 5
Define Transportation Activities for Tracking and Tracing .............................................................................. 5
Check Direct Output Agent (order tracking and instruction tracking scenarios) ............................................. 5
Check Change Notification Agent (resource tracking scenario) ..................................................................... 6
SAP EM Application Interface ......................................................................................................................... 6
Check SAP Event Manger Definition “Define SAP EM” ............................................................................................... 7
Define Used Bus. Proc. Types, Appl. Obj. Types, and Evt Types ................................................................................ 7
Check Customizing in SAP EM .......................................................................................................................... 9
Define Application System .............................................................................................................................. 9
Define Parameter Mapping ........................................................................................................................... 10
Define Criteria for Event Message Processing ............................................................................................. 11
Preprocessing Functions............................................................................................................................................ 11
Enable Multiple Tracking IDs ..................................................................................................................................... 11
Check BAdI Implementations ........................................................................................................................... 11
SAP TM BAdIs .............................................................................................................................................. 12
SAP EM BAdIs .............................................................................................................................................. 12
Debugging TM -> EM........................................................................................................................................ 13
Debugging EM -> TM........................................................................................................................................ 13
Enable Logging ................................................................................................................................................. 14
Logging in SAP TM ....................................................................................................................................... 14
Logging in SAP EM ....................................................................................................................................... 15
Common Errors ................................................................................................................................................ 17
SAP TM ......................................................................................................................................................... 17
SAP EM ......................................................................................................................................................... 18
Important SAP Notes ........................................................................................................................................ 19
SAP TM ......................................................................................................................................................... 19
SAP EM ......................................................................................................................................................... 19
Related Content ................................................................................................................................................ 21
Copyright........................................................................................................................................................... 22

2
Check Queues
• SAP TM:
o Outbound queues (TA SMQ1):
The standard outbound queue names are based on the pattern EM_<BPT>, for example.
“EM_TMS_TOR”. If updates from TM do not reach EM, for example event handler are not
being updated or event messages are not processed, check that the queue is active and
running. If status is “SYSFAIL”, check if a short dump has occurred in EM.

o Inbound queues (TA SMQ2):


 If you find cryptic queues like “EM0039t5Rk7kEujgB{cVoVEm”, these are the
queues to process the acknowledgement that is sent from SAP EM to SAP TM. The
pattern of the name is EM<EH_GUID>. If you find unprocessed entries here, this
can be the root cause for missing expected events on the TM execution tab. The
acknowledgements update table /SAPTRX/AOTREF with the EH_GUID (in field
TRXOBJECT). And if the EH_GUID is missing the expected events cannot be read
from SAP EM to display them on the execution tab. The transient node
EXECUTIONINFORMATION_TR cannot be created correctly, because only data
from TM can be taken into account.
Strong recommendation is to disable the acknowledgement in SAP EM. Please
check SAP note 2235954 for further details. Please check especially if all necessary
SAP notes have been implemented / support packages have been installed in your
SAP EM and SAP TM systems. Otherwise you have to enable the
acknowledgement, which is not recommended, especially in high volume scenarios.

 If entries for queues with name starting with ‘EM_’ are in status ‘SYSFAIL’, you can
check the error message in the details. If this does not give you enough information,
you can debug the processing of this new event information that has been
propagated from SAP EM.

SAP notes 1657784, 1868313, 1940507 and 1968414 bring enhancements


regarding the visibility of meaningful error messages in the queue monitor.

 It may also be the case these queues are not registered or activated and therefore
the entries are not processed. You should then register and/or activate all queues
starting with ‘EM*’ (see also chapter 1.3 in the integration guide for SAP TM and
SAP EM).

Check Short Dumps


If system behavior is not as expected, check the list of short dumps (TA ST22). Since most of the processing
is usually done in asynchronous background processes, short dumps may occur unnoticed.

Possible reasons for short dumps can be, for example:


- incorrect usage of rule activities in SAP EM
- errors in extraction function modules in SAP TM
If you have a direct relation to a queue entry in status “SYSFAIL”, you can restart the queue processing to
analyze the issue.

3
Check TORs and EHs
You should check the status of the objects (TOR object in SAP TM and event handler in SAP EM) in both
systems in detail.

• SAP TM:
Additionally to what you can see in the NWBC (e.g. execution tab on the freight order UI), you
should also check the EXECUTIONINFORMATION node on the test UI (TA /BOBF/TEST_UI). Only
here you can check which events have been persisted in SAP TM.

The field EXECINFO_SOURCE holds the information where the events come from:
o A: Reported Directly for this Document
o E: Propagated from SAP EM
o P: Propagated from Predecessor Document
o S: Propagated from Successor Document
o H: Derived from Handling Execution Status
o R: Read from SAP EM

• SAP EM:
In addition to what you can see on the web UI (which depends on the user profile you are using),
also check the event handler in the backend in the event handler list (TA /SAPTRX/EH_LIST). Here
you can check all the available parameters and all other available information in detail.

Check for locking issues


In both systems lock issues may occur, which lead to pending updates. You should check in both systems if
locking issues have occurred. Perhaps they are the root cause of missing updates or data inconsistencies.

• SAP TM:
Check database table /SCMTMS/D_TRIGHD. This is the table which stores triggers that are written
if a locking issue occurs. If entries are available in this table, data of the corresponding objects might
not be up to date.
Entries with the following trigger IDs are likely if updates for the execution information from SAP EM
could not be processed due to locking issues:
o “PROPAGATE_EXECUTION_INFO”
o “TOR_PROCESS_EXEC_INFO”
o “TOR_SET_EXECUTION_STATUS”

The TRIGGER_KEY refers to the key of the node, for which the trigger has been set. You should
then check if report /SCMTMS/PROCESS_TRIGGER_BGD is scheduled for periodic execution. This
report normally takes care of processing the triggers.

• SAP EM:
o Check database table /SAPTRX/LOCKEDEH. This is the table which stores event
messages that could not be processed due to locked EHs. Reprocessing of the event
messages is done with reports /SAPTRX/PROCESS_LOCKED_EHS_PPF or
/SAPTRX/PROCESS_LOCKED_EH. Check that one of the two is scheduled to run
periodically.
o Check database table /SAPTRX/RP_AOID. This is the table which stores application object
IDs that could not be posted due to locking issues (such as the update of an EH that has

4
been locked). Check that report /SAPTRX/R_REPOST_AI_LOGS which takes care of the
reposting, is scheduled for periodic execution.

Check Customizing in SAP TM


TOR Types Settings
Start by checking if the customizing settings for the TOR type (freight unit type, transportation unit type,
freight order type or freight booking type) are correct:
• Execution Tracking Relevance is to set to ‘Execution Tracking with External Event Management’
• Valid entry for Application Object Type
• Valid entry for Last Expected Event
• Correct settings regarding propagation
• Display Mode for Execution Tab controls which data is taken into account for creating transient node
EXECUTIONTRANSFORMATION_TR (for more information check SAP Note 1794944 )

Define Transportation Activities for Tracking and Tracing


You can find this IMG activity by following this path: SPRO -> SAP Transportation Management ->
Transportation Management -> Integration -> Tracking and Tracing of Processes and Documents -> Define
Transportation Activities for Tracking and Tracing.

Check that all the events that are to be used are maintained. Unexpected Events that should be propagated
between freight documents in SAP TM have to have one of the following two stop categories assigned:
• Stop with Change of Main Resource – Inbound
• Stop with Change of Main Resource – Outbound

This is because propagation is done via the association between the TOR stops that are assigned to each
other. For unexpected events the corresponding stop has to be determined based on the location ID. The
stop category determines the correct stop (outbound or inbound) in this case.

Check Direct Output Agent (order tracking and instruction tracking scenarios)
The direct output agents are used to trigger execution of the EM application interface processing when data
is changed in the related business object.

5
For more information on the different direct output agents and the ways they can be used, check document:
http://scn.sap.com/docs/DOC-52226 .
For the order tracking scenarios, check that only one of the two available DOAs is enabled
(SEND_EM_DATA_FROM_TOR or SEND_EM_DATA_FROM_TOR_ASYNC related to business object
/SCMTMS/TOR). In the IMG the path is SPRO -> Cross-Application Components -> Processes and Tools for
Enterprise Applications -> Reusable Objects and Functions for BOPF Environment -> PPF Adapter for
Output Management -> Maintain Output Management Adapter Settings -> Direct Output Agents (w/o PPF &
w/o History).
For the instruction tracking scenario, check that the DOA SEND_EM_DATA_FROM_INS (related to BO
/SCMTMS/INSTRUCTION) is enabled.

Check Change Notification Agent (resource tracking scenario)


For the resource tracking scenario, the change notification agent for application ‘TM_EM_RES’ has to be
active. (In the IMG follow path SPRO -> SAP Transportation Management -> SCM Basis -> Master Data ->
Change Notification Agent -> Maintain Change Notification Agent).

SAP EM Application Interface


It is always a good idea to check that all settings for the EM Application Interface are correct:

6
Check SAP Event Manger Definition “Define SAP EM”
SAP EM system needs to have a valid RFC destination. The SAP EM Version must be set to “SCM 4.0” and
local flag must not be set. The Sync flag should only be set in a testing environment and not in a productive
environment. This is also true if SAP TM and SAP EM are installed on the same system.

Note: The ‘Local’ flag must not be set – not matter if SAP EM and SAP TM are hosted on the same system
and client or not.

Define Used Bus. Proc. Types, Appl. Obj. Types, and Evt Types
Check that:
• all application object types and event types are enabled (EM Relevance of Application Object/Event
Type)
• the correct Event Manager is assigned for each and
• all other settings are as intended (for example relevance and extraction functions).

EH not created, updated or deleted: Check “Define Application Object Types”

7
Event Message was not sent: Check “Define Event Types”

8
Check Customizing in SAP EM
Define Application System
You have to have an entry for your application system with a valid RFC destination and logical system. In a
productive environment synchronous communication should never be enabled. In addition, the
Acknowledgment flag
 has to be enabled if the prerequisites described in SAP note 2235954 are not available
 should not be enabled if the prerequisites are available (recommended).

Note: The ‘Local’ flag must not be set – not matter if SAP EM and SAP TM are hosted on the same system
and client or not.

If there is no entry for the application system, the following error message occurs during execution of
/SAPTRX/BAPI_EH_POST:

9
Define Parameter Mapping
Check that there is a valid entry for your combination of application system and application object type in
‘Assign Profile to Mapping Area’:

If this entry is not available, no event handler is created and the following error message can occur:

10
Define Criteria for Event Message Processing

Preprocessing Functions
For the correct processing of event message that report a delay (event codes DELAYED or DELAYED_FU)
the following entries have to be available here:

BC Set /SAPTRX/BC_V_EHPPF can be used to add the customizing entries.

If these entries are missing, delays that are reported from the EM web UI cannot be processed correctly.

Enable Multiple Tracking IDs


For the correct processing of event message in scenario RES30_RESOURCE, the following entries have to
be available:

BC Set /SAPTRX/BC_RES30_V_EVMNT can be used to add the customizing entries. For more information
about “Multiple Tracking IDs” see: http://scn.sap.com/docs/DOC-48805

If these entries are missing, event messages that are sent from SAP TM to the resource event handler using
the standard event types cannot be processed in SAP EM.

Check BAdI Implementations


In general, start by checking if BAdI implementations are active and/or implicit enhancements have been
done.

11
SAP TM BAdIs

There are two available BAdIs that are directly involved in the integration of SAP TM and SAP EM:

• /SCMTMS/TOR_EVENT_PROC
used to influence the processing of incoming event message data (EM -> TM). Method
PROCESS_EVENT is called in method EXECINFO_PROCESS of class
/SCMTMS/CL_TOR_EXEC_PROCESS.
 Check this if issues occur during the processing of propagated event messages in SAP TM

• /SCMTMS/SEND_TOR_DATA
used to influence and optimize data retrieval and extraction (TM -> EM). Methods are called at
several places in method SEND_TOR_DATA of class /SCMTMS/CL_EVENT_MANAGEMENT
(CALL_EVENT_MGR , GET_ADDITIONAL_DATA, PREVENT_EVENT_MSG_SENDING) and in the
direct output agents (AVOID_RETRIEVAL_OF_APPL_TABLES).
 Check this if issues occur during
o data retrieval for the extraction (such as data is missing)
 GET_ADDITIONAL_DATA
 AVOID_RETRIEVAL_OF_APPL_TABLES
o event message sending (such as no sending takes place)
 PREVENT_EVENT_MSG_SENDING
o issues when using multiple queues for posting updates to SAP EM
 CALL_EVENT_MGR
 For more information see: http://scn.sap.com/docs/DOC-49085

SAP EM BAdIs
There are many BAdIs available in EM that can influence integration in many different ways. It is worthwhile
to check which of them are used and whether they may be having any negative side effects.
In the standard scenarios, the following BAdI implementation should be active:
- RES30_RESOURCE: /SAPTRX/GEN_EH_S_IMPL

12
- ODT30_INS: /SAPTRX/GEN_EH_S_IMPL
- ODT40_TO: /SAPTRX/ODATA_FIORI_APPS

Debugging TM -> EM
In general, you have to know in which mode (synchronous or asynchronous) the direct object agent is
running, because this can have an impact on how to debug the process:
• Has Critical o/p: Process during Save - before Commit: Nothing special has to be done.
Breakpoints should work as expected.
• Has Uncritical o/p: Process after Commit (background): Since the direct output agent is running
asynchronously in an update task, you have to enable “Update Debugging” in your debugger
settings. To ensure that the breakpoints work, you can set an additional break point in some coding
which is executed synchronously, for example in /SCMTMS/CL_TOR_D_ROOT_BS->
/BOBF/IF_FRW_DETERMINATION~EXECUTE. (This method is executed as soon as any change is
made to a TOR object). If the debugger window then pops up, you can enable “Update Debugging”
under Settings -> Change Debugger Profile/ Settings and save your changes.

For the resource tracking scenario you have to ensure that “Update Debugging” is enabled as well. When
changing or creating resources you can put an additional breakpoint in include
/SAPAPO/LDM_RESOURCEF01 either in
• form RES_HEAD_CHANGE if changes in resource header have been done
• form RESOURCE_TEXT_CHANGE if only description text has been changed .

Good candidates for debugging are the following:


• Direct Output Agents:
o SEND_EM_DATA_FROM_TOR: /SCMTMS/CL_OUTMGMT_EXEC_TOR->DISPATCH_INT
o SEND_EM_DATA_FROM_TOR_ASYNC: /SCMTMS/CL_DOA_EXEC_TOR_ASYNC-
>DISPATCH_INT
• Change Notification Agent /SCMTMS/CL_CNA_RES_H (for resource tracking)
• Extraction and relevance function modules you assigned to the application object type you are using
• Implemented methods of BAdI /SCMTMS/SEND_TOR_DATA, if used
• Function module /SAPTRX/INTERNAL_EM_COMMUNICAT as central point from which all extractors
and the EM BAPIs are called. Here you can e.g. check the result of your extraction.
• On EM side processing starts with one of the following two BAPIs:
o /SAPTRX/BAPI_EH_POST – update of the corresponding event handler
o /SAPTRX/BAPI_EH_ADDEVENTMSG_02 – sending of event messages

Debugging EM -> TM
• EM:
o If the standard activity is used to propagate event messages to SAP TM, this is, of course, a
good candidate for debugging: function module /SAPTRX/TMS_CHANGE_EXEC_INF. You
can change the local variable “lv_in_background“ in the debugger from ‘X’ to ‘ ‘ to have a
direct synchronous call to the TM system, which might be more suitable for debugging.

13
• TM
o processing starts with FM /SCMTMS/EXECINFO_PROCESS
o action that processes new or changed entries on node EXECUTIONINFORMATION:
/SCMTMS/CL_TOR_A_PROC_EXEC->/BOBF/IF_FRW_ACTION~EXECUTE
o action that processes the propagation to related TORs:
/SCMTMS/CL_TOR_A_PROP_EXEC_INF->/BOBF/IF_FRW_ACTION~EXECUTE

Enable Logging
If you have deactivated logging to optimize performance, you may activate it again temporarily to support the
error analysis.

Logging in SAP TM
In SAP TM the application log (TA SLG1) can be activated/deactivated
- per application object type (TA /SAPTRX/ASC0AO -> Select BPT -> Define Application Object Type)
- per event type (TA /SAPTRX/ASC0AO -> Select BPT -> Define Event Type ).

14
Logging in SAP EM
In SAP EM there are several settings to control how extensive the application log is.

• Settings for event handler types


For each event handler type you can define different levels of logging the processes of event
handler posting, event message processing and external updates. You can check these logs in the
application log (TA SLG1).

15
• Settings for rule set task
For each rule set task you can define whether it should be logged or not. You can check this log in
the event handler list on tab “Tasks” (TA /SAPTRX/EH_LIST).

16
Common Errors
SAP TM
- Wrong reference to stop in expected event
 Inbound queue (for FM /SCMTMS/EXECINFO_PROCESS) is in status SYSFAIL with error
message such as “TOR with ID XXX has no stop with key XXX” (at least if SAP Note 1940507 is
implemented, otherwise a short dump occurs)

 This can happen, if an event message is sent for an expected event in SAP EM and propagated
to SAP TM. If a custom extraction function is used for the expected events and reference to a
wrong stop is set there, the correct stop cannot be determined for the related TOR.

- RFC user has not enough authorizations (role /SAPTRX/SAP_EM_ADMIN is needed or equivalent
role)
 Event Handlers are not created, event messages are not processed due to missing
authorizations. This can be easily checked in the BAPI return messages respectively in the log.

17
- Acknowledgment is not sent -> no retrieval of EM data for execution tab
 Either the sending of the acknowledgment is not enabled (IMG activity “Define Application
System” in SAP EM) without having the prerequisite notes/SPs available or somehow the
acknowledgement was not sent correctly. This leads to incomplete data in table
/SAPTRX/AOTREF in SAP TM. Then no EM data can be displayed on the execution tab of the
freight document.
 Strong recommendation is to disable the acknowledgement in SAP EM. Please check SAP note
2235954 for further details. Please check especially if all necessary SAP notes have been
implemented / support packages have been installed in your SAP EM and SAP TM systems.
Otherwise you have to enable the acknowledgement, which is not recommended, especially in
high volume scenarios.

- Locking issues with table /SAPTRX/AOTREF


 These can be caused by the acknowledgement, which is sent from SAP EM to SAP TM to
update entries in table /SAPTRX/AOTREF. Strong recommendation is to disable the
acknowledgement in SAP EM. Please check SAP note 2235954 for further details. Please check
especially if all necessary SAP notes have been implemented / support packages have been
installed in your SAP EM and SAP TM systems. Otherwise you have to enable the
acknowledgement, which is not recommended, especially in high volume scenarios.

- No scheduling for freight order -> missing expected events for loading/unloading
 If freight order has not been scheduled, the date/times for loading/unloading
(REQ_START/REQ_END) might not be available on the related stops. If this is the case, the
standard extractors do not create expected events for loading and unloading.

- Performance issues with the data extraction for SAP EM


 If you use the generic SAP EM data extraction you should check SAP note 2089363. In general,
the generic extraction is not recommended to be used in SAP TM.
 Please check document Integration of SAP TM and SAP EM – Optimizing the Performance for
further details on how the performance can be optimized.

SAP EM
- Missing task to check reprocessing in rule set
 Before sending an update to TM via rule set activity TM_MAINTAIN_EXEC_INF (or any custom
activity), check that this is not done if event messages are reprocessed (via rule set activity
CHECK_REPROCESS_FLAG). You can check how this should be done in any of the standard
multitask activities such as ODT30_FU_ARRIVAL.
 If this check is omitted, this can lead to multiple unnecessary updates sent to TM and in the
worst case to endless roundtrips.

- Resend event message to same EH


 Resending event messages to the same event handler in the rule set has to be avoided,
because this can lead to inconsistencies in the DB. This in turn can lead to short dump when EH
is updated at a later point in time (due to duplicate keys).

18
Important SAP Notes
SAP TM

1756885 Event message is not propagated from SAP EM to SAP TM

2100110 Update of execution information gets lost due to locking issue (2)

2099044 No stop is determined for unexpected event that has been propagated from SAP EM to SAP
TM(2)

2072659 Parameters are not deleted for an event handler if related item is deleted in the freight
document

2084540 TRQ related tracking IDs are not extracted correctly

2029960 Direct output agent 'SEND_EM_DATA_FROM_TOR' is not working correctly

1950974 Short dump after reporting multiple events in SAP EM in one transaction

2138567 Missing back-up to read data from SAP EM (3)

1968414 Propagated execution information from SAP EM is not saved due to error message

1940507 Short dump when event message is propagated to TM with wrong TORSTOPUUID

1868313 Short dump in /SCMTMS/CL_TOR_EXEC_PROCESS

2128183 Extraction of loading, unloading, coupling and decoupling expected events is not correct

2228613 Function module /SAPTRX/DEL_ARCHIVED_EH_DATA can only be called with list of EH


guids

2089363 Usage of the generic SAP EM data extraction in SAP TM systems

SAP EM

1974670 Missing data when displaying reported expected events

1951993 Display of consolidated events not correct if one event message matches multiple expected
events

2039801 Event handler gets recreated although no relevant change has been posted

19
1935720 Authorization check is not working correctly

2162655 Missing back-up to read data from SAP EM (2)

2228615 Function module /SAPTRX/DELETE_AS_DATA only supports deleting via EH guids

2235954 Acknowledgement should not be used in TM - EM integration scenarios

20
Related Content
SAP Event Management – Scenarios for SAP Transportation Management
Resource Tracking Scenario for SAP Transportation Management
Integration of SAP TM and SAP EM – Optimizing the Performance
Integration of SAP TM with SAP EM – Details on the Direct Output Agents

21
Copyright
© 2015 SAP SE SE or an SAP SE affiliate company. All rights reserved.
No part of this publication may be reproduced or transmitted in any
form or for any purpose without the express permission of SAP SE.
The information contained herein may be changed without prior notice.
Some software products marketed by SAP SE and its distributors contain proprietary software components
of other software vendors. National product specifications may vary.
These materials are provided by SAP SE and its affiliated companies (“SAP SE Group”) for informational
purposes only, without representation or warranty of any kind, and SAP SE Group shall not be liable for
errors or omissions with respect to the materials. The only warranties for SAP SE Group products and
services are those that are set forth in the express warranty statements accompanying such products and
services, if any. Nothing herein should be construed as constituting an additional warranty.
SAP SE and other SAP SE products and services mentioned herein as well as their respective logos are
trademarks or registered trademarks of SAP SE in Germany and other countries.
Please see
http://www.sap.com/corporate-en/legal/copyright/index.epx#trademark
for additional trademark information and notices.

22

You might also like