Summary

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:

  • RESOURCE

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.

  • LONGITUDE

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.

  • LATITUDE

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.

   /wp-content/uploads/2016/06/0001_986855.png

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.

 

/wp-content/uploads/2016/06/0002_986856.png

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.


               /wp-content/uploads/2016/06/0003_986857.png 

    • 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

    

               /wp-content/uploads/2016/06/0004_986858.png

  • 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.

    

     /wp-content/uploads/2016/06/0005_986859.png   

     /wp-content/uploads/2016/06/0006_986860.png

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.

/wp-content/uploads/2016/06/00007_986867.png

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:

  /wp-content/uploads/2016/06/0008_986868.png

Related Notes

Note

Description

Support Package

2330523

New rule set activity to update resource position in SAP TM

EM 9.2 SP07

2026326

New rule set activity to update resource master data in SAP TM

EM 9.0 SP08

2012789

Enhancements on Resource Master for TM

SCM_BASIS 713 SP05

2029284

Resources: New attributes and enhancements on latest resource position

TM 9.1 SP03

2034347

New function module to update resource master data

TM 9.1 SP03

2045118

New function module to update resource master data (2)

TM 9.1 SP04

2101444

Dump in the function module: /SCMTMS/UPDATE_RESOURCE while reporting an event for a resource

TM 9.1 SP05

 

To report this post you need to login first.

2 Comments

You must be Logged on to comment or reply to a post.

  1. Zenon Kowalewski

    Hi Daniel.

    Thanks for this..

    I successfully set this up to monitor a fleet of 20 trucks on the TM Map.Very nice!

    Question:  Is it possible to send the Latitude/Longitude with a POD event and display the position of the POD on the TM Map?   Could I send  GEOLAT and GEOLON  in  TM_MAINTAIN_EXEC_INF.  I checked document ‘How to extract additional Parameters for the EM –TM Integration’.   Looks like it’s possible to send the parameters but will they be displayed on the TM Map?

    Thanks,

    Zenon.

    (0) 
    1. Daniel Haerder Post author

      Hi Zenon,

      if you use this activity with POD event, then in TM the information should be available in table /SCMTMS/RES_POS. In field TRANS_ACTIVITY you should have the value ’06’ which is POD. So the information in general is available in TM.

      In the standard the TM map refers to this table (as far as I know) and not to EXECUTIONINFORMATION node.
      But I am not an expert regarding the TM map. Maybe you have to ask the question in the TM forum instead.

      Best regards, Daniel

      (1) 

Leave a Reply