Multiple Tracking IDs

SAP EM – How to use Multiple Tracking IDs
Author: Marco Freischlag
Document Date: 02.11.2013
www.sap.com
TABLE OF CONTENTS
1
SUMMARY ........................................................................................................................................ 3
2
PREREQUISITE ................................................................................................................................ 3
3
SAMPLE SCENARIO FOR MULTIPLE TRACKING IDS USE CASE: ............................................ 4
4
SOLUTION SAMPLE ........................................................................................................................ 5
Customizing SAP EM ...................................................................................................................................... 5
Event Message Layout for Multiple Tracking IDs: ....................................................................................... 6
Event message header ...................................................................................................................................... 6
Further References ............................................................................................................................................ 6
Event Message Sample ..................................................................................................................................... 7
5
ADDITIONAL INFORMATION .......................................................................................................... 8
Criteria for Enabling Multiple Tracking IDs ................................................................................................... 8
RESTRICTION: ................................................................................................................................................. 8
PERFORMANCE NOTE.................................................................................................................................... 8
6
MONITORING: EVENT MESSAGE STATUS................................................................................... 9
7
SAMPLE CODING: ......................................................................................................................... 10
Event Message Header ................................................................................................................................. 10
Further References ........................................................................................................................................ 10
SAP EM – How to use Multiple Tracking IDs
1 SUMMARY
With SAP EM 9.0 SP4 a new feature “Multiple Tracking IDs” is introduced. Using this new
functionality within SAP EM it’s possible to send a single event message and apply it to
multiple event handlers.
This document describes a sample scenario and a possible use case for which the
multiple tracking id functionality might be useful.
2 PREREQUISITE
SAP EM 9.0 SP4 or Note 1917245
3
SAP EM – How to use Multiple Tracking IDs
3 SAMPLE SCENARIO FOR MULTIPLE TRACKING IDS USE
CASE:
You use this functionality for example when you want to send a single Event Message and
apply it to multiple Event Handlers to track for example at the level of a single railcar
resource. One or multiple railcars can be assigned to a rail freight order directly or via
railcar unit. When a shipper reports the ARRIVAL event for the entire freight order, a single
event message is sent to SAP Event Management for the assigned railcar resources. This
event message then needs to be propagated to all railcars for which this event applies.
On the Rail Freight Order level an ARRIVAL event message is sent which is configured for
the Multiple Tracking ID use case. In SAP EM the customizing for the visibility scenario
and event message is checked and if relevant the event message is use for multiple event
handlers within SAP EM.
In this scenario the single ARRIVAL event message would be applied to all relevant railcar
event handlers which are referenced within the event message.
4
SAP EM – How to use Multiple Tracking IDs
4 SOLUTION SAMPLE
CUSTOMIZING SAP EM
SAP IMG  Event Management  Event Messages, Status Queries, and Web Interface
 Define Criteria for Event Message Processing  Structure Item “Enable Multiple
Tracking IDs”
To enable this functionality for the resource event handler and arrival event message,
create the following entry:



Internal event code: "ARRIV_DEST"
Tracking ID code set: "RES_ID"
Event message sender (code set and code ID): "*"
The Event Message header parameters from the source system must match the above
customizing values and for each railcar event handler an entry in the further reference
table must be created with REFUSAGE value 'M'.
5
SAP EM – How to use Multiple Tracking IDs
EVENT MESSAGE LAYOUT FOR MULTIPLE TRACKING IDS:
In order to be able to activate Multiple Tracking IDs first of all the event message must be
sent in a special format.
Event message header
The event message header parameter must match the entry in the “Enable Multiple
Tracking IDs” table in the EM system. If the event message is valid for the multiple tracking
id use case the tracking id in the event message header is overwritten with the REFID
from the further references table.
Further References
Specify the each tracking id for the event handlers in EM in the further reference table for
which this event message should be applied to.
With EVTCNT the system finds the corresponding further reference entries. Only those
entries are relevant for the multiple tracking id use cases which have the REFUSAGE ‘M’.
The REFID will be the tracking id which will be used in the event message header when
rebuilding the event messages in the EM system. The REFCOD in the further reference
table must match the TRXCOD in the event message header.
6
SAP EM – How to use Multiple Tracking IDs
Event Message Sample
7
SAP EM – How to use Multiple Tracking IDs
5 ADDITIONAL INFORMATION
CRITERIA FOR ENABLING MULTIPLE TRACKING IDS
You specify an entry in the customizing table to enable the functionality for multiple
tracking IDs. When an event message is processed the system checks if the data in the
event message header matches the criteria defined in the customizing table. If the criteria
in the "Enable Multiple Tracking IDs" customizing match, the functionality for multiple
tracking IDs is switched on for this event message.
This customizing setting is used to apply one event message to multiple event handlers
depending on the information in the Further Reference table. If the field Further Reference
Usage "REFUSAGE" has the value "M" for at least one entry in the Further Reference
table, then this entry contains a tracking ID for which this event message is processed.
Note:
If the event message is relevant for the multiple tracking IDs according to the
customizing but in the Further Reference table no entry exists with "REFUSAGE"
value "M", then the event message is invalid.
The System processes the event message for each event handler with a tracking ID
in the Further Reference table that has the value "M" for the field Further Reference
Usage. In this case, the tracking ID in the event message header is ignored and it is
overwritten with the information in the "REFID" field. Note that the event message
header tracking ID must be specified but you can set it to a dummy value and
besides the Tracking ID, all fields in the event message header are the same.
RESTRICTION:
For the event message to be relevant for Multiple Tracking IDs, the following must match
or the event message is invalid:


At least one entry in the Further Reference table for the field Further Reference
Usage (REFUSAGE) must have the value "M" for each Event Message Header
relevant for Multiple Tracking IDs
The Tracking ID Code Set (TRXCOD) in the Event Message Header table must
match with the Further Reference Code Set (REFCOD)
PERFORMANCE NOTE
If the Resource Tracking Scenario is extensively used please consider the following
SAP Note: 1930447 - Table Index for /SAPTRX/EVM_REF for Resource Tracking
in order to avoid performance issues.
8
SAP EM – How to use Multiple Tracking IDs
6 MONITORING: EVENT MESSAGE STATUS
In EM SP4 also the Event Message Status Monitor (TA /n/saptrx/evm_status) is enhanced
with a new Message Status “Partially”. If the event message cannot be processed for all
the Tracking IDs specified in the further references or contains invalid data for the multiple
tracking ID scenario the message is logged as partially processed.
There are two reasons why an event message can be logged as partially processed:
- At least one EH is logged for the Tracking IDs specified in the further references with
Ref. Usage ‘M’
- The event message is determined to be relevant for the multiple tracking ID scenario
but does not contain at least one further reference entry with Ref. Usage ‘M’
9
SAP EM – How to use Multiple Tracking IDs
7 SAMPLE CODING:
EVENT MESSAGE HEADER
*
*
Event ID
ls_trackingheader-evtid
= /scmtms/if_tor_const=>sc_tor_event-arriv_dest.
Event Date/Time
GET TIME STAMP FIELD lv_tst.
ls_trackingheader-evttst = lv_tst.
ls_trackingheader-sndnam = /scmtms/if_scem_res_int_c=>gc_sendername_tm.
*
Tracking ID Code Set
ls_trackingheader-trxcod = /scmtms/cl_scem_int_c=>sc_trackid_codesets-resource.
*
Tracking ID
ls_trackingheader-trxid
= 'dummy'.
ls_trackingheader-datacs
ls_trackingheader-dataid
= <fs_tor_root>-tor_cat.
= <fs_tor_root>-tor_id.
LOOP AT lt_tor_execinfo ASSIGNING <fs_tor_execinfo>
WHERE parent_node_id = <fs_tor_root>-node_id
AND event_code
= /scmtms/if_tor_const=>sc_tor_event-arriv_dest.
READ TABLE lt_tor_execinfo_before
WITH TABLE KEY node_id COMPONENTS node_id = <fs_tor_execinfo>-node_id
ASSIGNING <fs_tor_execinfo_before>.
*
Counter for Event
gv_evtcnt
ls_trackingheader-evtcnt
= gv_evtcnt + 1.
= gv_evtcnt.
*
reason code
IF <fs_tor_execinfo>-event_reason IS NOT INITIAL.
ls_trackingheader-srctx = <fs_tor_execinfo>-event_reason.
ENDIF.
*
check for actual event time
IF <fs_tor_execinfo>-actual_date IS NOT INITIAL.
ls_trackingheader-evttst = <fs_tor_execinfo>-actual_date.
ENDIF.
FURTHER REFERENCES
CLEAR ls_trackreferences.
*
'M' = multiple Tracking IDs in TRACKREFERENCES
ls_trackreferences-refusage = 'M'.
ls_trackreferences-evtcnt
= gv_evtcnt.
IF <fs_tor_root>-tor_cat = /scmtms/if_tor_const=>sc_tor_category-active.
Read vehicle data
LOOP AT lt_tor_item ASSIGNING <fs_tor_item> USING KEY parent_node_track_rel
WHERE parent_node_id = <fs_tor_root>-node_id
AND track_exec_rel
= /scmtms/if_tor_const=>sc_tracking_relevanceexec_track_em
AND vehicleres_id
IS NOT INITIAL.
*
*
*
Tracking ID Code Set - RES
ls_trackreferences-refcod
Tracking ID - ResourceID
ls_trackreferences-refid
= /scmtms/if_scem_res_int_c=>sc_trackid_codesets-resource.
= <fs_tor_item>-vehicleres_id.
APPEND ls_trackreferences TO ct_trackreferences.
ENDLOOP.
ENDIF.
10
www.sap.com
© 2013 SAP AG. All rights reserved.
SAP, R/3, SAP NetWeaver, Duet, PartnerEdge, ByDesign, SAP
BusinessObjects Explorer, StreamWork, SAP HANA, and other SAP
products and services mentioned herein as well as their respective
logos are trademarks or registered trademarks of SAP AG in Germany
and other countries.
Business Objects and the Business Objects logo, BusinessObjects,
Crystal Reports, Crystal Decisions, Web Intelligence, Xcelsius, and
other Business Objects products and services mentioned herein as
well as their respective logos are trademarks or registered trademarks
of Business Objects Software Ltd. Business Objects is an SAP
company.
Sybase and Adaptive Server, iAnywhere, Sybase 365, SQL
Anywhere, and other Sybase products and services mentioned herein
as well as their respective logos are trademarks or registered
trademarks of Sybase Inc. Sybase is an SAP company.
Crossgate, m@gic EDDY, B2B 360°, and B2B 360° Services are
registered trademarks of Crossgate AG in Germany and other
countries. Crossgate is an SAP company.
All other product and service names mentioned are the trademarks of
their respective companies. Data contained in this document serves
informational purposes only. National product specifications may vary.
These materials are subject to change without notice. These materials
are provided by SAP AG and its affiliated companies ("SAP Group")
for informational purposes only, without representation or warranty of
any kind, and SAP Group shall not be liable for errors or omissions
with respect to the materials. The only warranties for SAP 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.
.