New ruleset activity TM_UPDATE_RES_POS has been introduced in SAP EM 9.2 with note 2330523 (and will be included in the next support package EM 9.2 SP07). This activity can be used to enhance e.g. the freight order tracking scenario (integration scenario with SAP TM). If a vehicle resource (e.g. a truck) is assigned to a freight order, it allows to update the last position of this resource in SAP TM without the need to propagate the event message to the freight order in SAP TM. So far this was only possible via existing rule activity TM_UPDATE_RESOURCE (see http://scn.sap.com/docs/DOC-60764 ). This activity supports already updates on the resource in SAP TM, but only if the resource itself is tracked in SAP EM and event messages are processed for the resource event handler.
Ruleset Activity in SAP EM
Definition of TM_UPDATE_RES_POS
The new ruleset activity TM_UPDATE_RES_POS requires three rule activity parameters, which are listed here:
The resource ID, which is used to identify the resource in SAP TM. In standard freight order tracking scneario it is available via corresponding control parameter of the freight order event handler. In the standard resource tracking scenario it is available via main tracking ID of the resource event handler.
The longitude geo coordinate which is needed to update the last location of the resource in SAP TM. Should normally be available as event message parameter.
The latitude geo coordinate which is needed to update the last location of the resource in SAP TM. Should normally be available as event message parameter.
The function module /SAPTRX/TMS_UPDATE_RES_POS calls RFC function module /SCMTMS/UPDATE_RESOURCE in SAP TM via background task. The queue name is build via concatenation of ‘EM_’ and the resource ID, which is provided by the first rule activity parameter. In the standard freight order tracking scenario (EH Type ODT30_TO) the resource ID of the assigned truck is available via control parameter VEHICLE_RES_ID. For debugging you can set a breakpoint before the call of the FM is done and easily switch to synchronous mode by clearing variable LV_IN_BACKGROUND.
Usage of TM_UPDATE_RES_POS
The following screen shot shows an example on how the activity can be used to update the last position of a resource in SAP TM (in database table /SCMTMS/RES_POS) as reaction on an event that is reported to the event handler of the freight order in SAP EM. The resource is assigned as vehicle resource to the freight order (e.g. a truck) and is available via control parameter VEHICLE_RES_ID. The geo coordinates are available as event message extension parameters of the event message.
Necessary settings in SAP TM
You can check the document regarding rule activity TM_UPDATE_RESOURCE (http://scn.sap.com/docs/DOC-60764 ) for details on the necessary settings in SAP TM, since both rule activities call the same function module /SCMTMS/UPDATE_RESOURCE in SAP TM.
How to enhance standard tracking scenario to include the new rule activity
If you want to support “SIGHTING” events for your freight order event handler to report the exact position based on geo coordinates, you can create a custom event handler type as described below.
Custom event handler type
You can copy the standard event handler type ODT30_TO to new event handler type ZGEO_ODT30_TO and make the following changes:
- Regarding new supported event “SIGHTING” you can either
- add “SIGHTING” as allowed unexpected event code for the event handler type
You should handle “SIGHTING” as unexpected event if you do not need to keep the single event messages with the event handler. Event message then can be used to update the last known position in EM and TM and then processing can be quit.
- or create new expected event profile ZGEO_ODT30_TO (as copy of ODT20_TO) with new entry for “SIGHTING”, so that one expected event “SIGHTING” is created for each freight order event handler automatically without expected date/time and expected location.
By this, each “SIGHTING” event message can be processed against the expected event (the flag “Reprocess Expected Event” has to be set), but on the UI only the latest one will be shown
- Assign new custom rule set ZGEO_ODT30_TO, which can be created as copy of ODT30_TO
- New rule and new multitask activity for the “SIGHTING” event messages is needed
- New multitask activity can e.g. update the control parameters of the event handler which hold the latest geo coordinates (by using standard multitask activity ODT30_EVM_GEO_DATA) and update the last position of the assigned resource in SAP TM with the new activity TM_UPDATE_RES_POS. Optionally an additional task could be added to quit the event message processing, if the event message itself is not needed anymore by using standard rule activity method QUIT_EVM_PROCESSING.
Test via EM web UI
To test the new rule activity TM_UPDATE_RES_POS the standard user profile ODT30_TO can be copied to new user profile ZGEO_ODT30_TO. The related selection profile and event message profile have to be copied as well.
In the selection profile the configured field ODT30_EH_TYPE_TO has to be replaced by new configured field that contains the selection for the new event handler type.
The event message profile can be enhanced with new event reporting item to allow reporting of “SIGHTING” event messages from the EM web UI.
To send simple event message for “SIGHTING” with optional location ID, latitude, longitude and reporting time stamp the following event reporting item details can be maintained:
New rule set activity to update resource position in SAP TM
EM 9.2 SP07
New rule set activity to update resource master data in SAP TM
EM 9.0 SP08
Enhancements on Resource Master for TM
SCM_BASIS 713 SP05
Resources: New attributes and enhancements on latest resource position
TM 9.1 SP03
TM 9.1 SP03
TM 9.1 SP04
Dump in the function module: /SCMTMS/UPDATE_RESOURCE while reporting an event for a resource
TM 9.1 SP05