PLANNING AND DESIGN PUBLIC SAP Global Track and Trace Document Version: Cloud 2018.09a 2018-09-27 2018 SAP SE or an SAP affiliate company. All rights reserved. THE BEST RUN
Content 1 Introduction....3 1.1 About this Document....3 1.2 Target Audience....3 2 Event to Action....4 3....6 3.1 Prerequisites....6 3.2 Business Rules....6 3.3 Create a Rule.... 12 3.4 Edit a Rule.... 13 3.5 Delete a Rule....14 3.6 Activate or Deactivate a Rule.... 14 2 P U B L I C Content
1 Introduction The SAP Global Track and Trace solution includes an event-to-action engine, a tool that automatically triggers actions if certain events are processed for a tracked process or object. This is an optional feature in SAP Global Track and Trace. You can choose to enable the event-to-action engine to meet your business needs. To enable the event-to-action engine, you can create business rules for deployed GTT models. In the rules, you define what conditions will trigger actions and what specific actions will be triggered. Once a business rule is defined and activated, whenever an actual event occurs that matches the conditions defined in the rule, the corresponding action is put into effect. 1.1 About this Document This document describes how to apply business rules to GTT models to enable the event-to-action engine in SAP Global Track and Trace. Before you start working through this document, ensure that you have downloaded the most recent version of this document that is available from: https://help.sap.com/viewer/p/sap_global_track_and_trace 1.2 Target Audience Role Activity Solution Administrator Create, edit, delete, activate, and deactivate business rules for GTT models. Introduction P U BL IC 3
2 Event to Action The use of the event-to-action engine involves the following components. Component Tasks to Accomplish Design Time/Run Time MM app Deploy a GTT model of a tracked process or object. Design time GMM app Define and activate business rules for predefined rule services. Design time and run time GTT event-to-action engine Execute rules when processing business data. Run time GTT app View the actions triggered by the eventto-action engine. Run time Note The event-to-action engine supports as input a tuple of a tracked process or object instance and an actual event. It is assumed that when an actual event is received, its corresponding tracked process or object is already available and is thus ready for correlation. Below shows the end-to-end scenario for enabling the event-to-action engine: 1. Deploy a GTT model in the MM app. This is performed by a Solution Administrator. In the MM app, create and deploy a GTT project. For a detailed procedure, see the "Working with the MM App" section in the Creating and Deploying GTT Models document. When a GTT project is deployed, the tracked process entity and event entities in the GTT model are automatically mapped to business rule data objects, and the elements of the entities are mapped to data object attributes. In the following step, you will use these data objects and attributes to define your rules. Note You can only use the top-level elements of an entity to create rules. Associations to other entities cannot be used in rule definition. 2. Define and activate rules in the GMM app. This is performed by a Solution Administrator. In the GMM app, locate your GTT model, and define business rules for the model. For a detailed procedure, see "Create a Rule" in this document. After the rules are created and saved, choose Activate to put them into effect. Note Rules used for GTT models must be created and activated in the GMM app. Rules defined or deployed in SAP Cloud Platform Business Rules are not supported. 4 P U B L I C Event to Action
3. View Actions triggered in the GTT app.. This is performed by an end user, such as a Delivery Specialist, Shipment Specialist, or EPCIS Specialist. Now the event-to-action engine has been configured and enabled. When you track and trace business processes or objects with the GTT app, if an actual event is processed for a tracked process or object, the corresponding rules are evaluated. For each condition that evaluates to true, the related action defined in the rule is automatically triggered. Related Information Create a Rule [page 12] Event to Action P U B L I C 5
3 As a Solution Administrator of SAP Global Track and Trace, you can use the GTT Metadata Modeling app (GMM app) to define and activate business rules for GTT metadata models. 3.1 Prerequisites The GTT metadata models for which you want to define and manage rules have already been created and deployed to the runtime repository with the Metadata Modeling app. You are able to log on to the GMM app as a Solution Administrator. 3.2 Business Rules The GMM app provides the following rule services that can be deployed to GTT run time. You can create rules for each type of these rule services. The format of result and result attributes for each rule service are predefined. Rule Service Name Action to Trigger ActionUpdateTrackedProcess ActionFLPNotification ActionEmailNotification ActionCPIForwarding ActionUpdatePlannedEvent ActionUpdatePersonalDataRetentionDate Updates the status properties or the header properties of a tracked process. Sends SAP Fiori Launchpad notifications to specific users. Sends email notifications to specific users. Forwards the business data consisting of tracked process type and event to SAP Cloud Platform Integration. Then you can customize integration flows (iflows) to process these business data according to your needs.. Updates the planned time for an event. Configures the residence period and retention period of users' personal data. 6 P U B L I C
Note The last rule service in the above table is only accessible by DP&P Specialists. For its detailed usage, refer to the SAP Global Track and Trace Security Guide. Data Objects and Attributes The data objects and their attributes that you can use to define business rules are extracted from your deployed GTT model, including the following: The tracked process itself is available as a data object, with its header level properties as the data object attributes. Each planned event and unplanned event defined in the GTT model is available as a data object, with its header level properties as data object attributes. Business partners of a traced process are available as data objects, with their properties as data object attributes. If your GTT model is of standard mode, ProcessEventDirectory, as an index of planned and unplanned events, is available as a data object. It includes event associations defined in your GTT model. The pre-defined rule services are available as data objects, such as ActionUpdateTrackedProcess and ActionFLPNotification. These data objects can be selected as result/output columns when you define rules. Rule Definitions and Decision Table The rule definitions and decision table settings are shown below. ActionUpdateTrackedProcess This type of rules is used to update the status of a property of a tracked process instance upon certain events. You need to specify the following for the rule: The condition under which a property status will be updated. attribute1 The property that has a value to be updated once the specified condition is met. value1 The new status that the property will be updated to. You can also specify attribute2/attribute3 and value2/ value3, if more than one properties will change values. Example To define a rule that expresses the following logic: P U BL IC 7
If an event of type DelayedEvent is processed for an instance of the delivery tracked process and the "NewDeliveryDate" in the event message is later than the "DeliveryDate" in the delivery tracked process, then update the delivery status of the delivery tracked process to value "Critically Delayed". If no "NewDeliveryDate" is sent with the event message, or if it is not later than the "DeliveryDate" in the delivery, do nothing. The decision table can look like the following: NewDeliveryDate of the DelayedEvent of a DeliveryProess is later than deliverydate of the DeliveryProcess attribute1 value1 'deliverystatus' '03' ActionFLPNotification This type of rules is used to send SAP Fiori Launchpad notifications to specific users upon certain events. You need to specify the following for the rule. The condition under which a notification will be sent. priority Priority of the notification in SAP Fiori Launchpad. Available values are High, Medium and Low (the first letter must be capitalized). recipients Email address of the notification recipient. If there are multiple recipients, separate the email addresses with semicolons. message The content of the message that the recipient(s) will receive. Example To define a rule that expresses the following logic: If the delivery status of a delivery tracked process is updated to value "Critically Delayed", then trigger a notification in SAP Fiori Launchpad. This should be set up for all the responsible users (solution participants). Otherwise, do nothing. 8 P U B L I C
The decision table can look like the following: NewDeliveryDate of the DelayedEvent of a DeliveryProess is later than deliverydate of the DeliveryProcess priority recipients message 'High' '<mail_address_1>;<mail_address_2>' 'Critically delayed event is received' ActionEmailNotification This type of rules is used to send email notifications to specific users upon certain events. You need to specify the following for the rule. The condition under which an email will be sent. recipients Email address or business partner ID of the notification recipient. If there are multiple recipients, separate them with semicolons. subject The subject of the message that the recipient(s) will receive. message The content of the message that the recipient(s) will receive. Note The sender email, sender name, and reply-to email are maintained by the Onboarding Administrator in the Onboarding Assistance app. Example To define a rule that expresses the following logic: If the delivery status of a delivery tracked process is updated to value "Critically Delayed", then send an email to notify related users. Otherwise, do nothing. The decision table can look like the following: NewDeliveryDate of the DelayedEvent of a DeliveryProess is later than deliverydate of the DeliveryProcess P U BL IC 9
recipients subject message '<mail_address_or_business_partner_id_1> ;<mail_address_or_business_partner_id_2> ' 'Event Delayed' 'Critically delayed event is received' ActionCPIForwarding This type of rules is used to forward the business data consisting of tracked process type and event to SAP Cloud Platform Integration. It requires an integration flow across different systems. Most configuration is done in relevant systems, such as the customer's SAP ERP system, SAP Cloud Connector, and SAP Cloud Platform Integration. Besides that, you also need to specify the following for the rule. The condition under which the configured data forwarding will happen. CPIEndpoint The URL of the SAP Cloud Platform Integration endpoint. Note CSRF Protection is not supported for the endpoints that are called. To have your credentials configured for the outgoing call, create a ticket on component IOT-GTT-OPS. Example The decision table can look like the following: eventtype of the DepartureEvent contains 'DEPARTURE' CPIEndpoint https://<your CPI server IP address>/ http/erp/inbound_dlv ActionUpdatePlannedEvent This type of rules is used to update the planned time of an event. The planned time of a planned event is usually read from another system and cannot be changed in the GTT app user interface. However, there are cases that the planned time of an event is open and dependent on another event in the same tracked process. In such cases, you can create a rule to set or update the planned time of the event. 10 P U B L I C
You need to specify the following for the rule: The condition under which the planned time of an event will be updated. processeventdirectoryid plannedbusinesstimestamputc plannedbusinesstimezone plannedtechnicaltimestamputc The ID of the event that has a planned time to be updated. The new planned business time to be updated to. The time zone of the new planned business time. The new planned technical time to be updated to. Example To define a rule that expresses the following logic: If an event's type contains 'RP' happens, then update the planned business time and technical time of another event. The decision table can look like the following: eventtype of the reportplannedtimestampevent of a DeliveryProcess contains 'RP' processeventdirectoryid plannedbusinesstimestamputc plannedbusinesstimezone plannedtechnicaltimestamputc reportedped of the reportplannedtimestampevent of a DeliveryProcess plannedbusinesstimestamputc of the reportplannedtimestampevent of a DeliveryProcess plannedbusinesstimezone of the reportplannedtimestampevent of a DeliveryProcess plannedtechnicaltimestamputc of the reportplannedtimestampevent of a DeliveryProcess P U BL IC 11
3.3 Create a Rule Context Rules used for GTT models must be created in the GMM app. SAP Global Track and Trace does not support rules defined in SAP Cloud Platform Business Rules. You can only create rules of type Decision Table. Rules of type Text Rule are not supported. Procedure 1. Launch the GMM app. 2. On the search page, locate your target model for which you want to define a rule. 3. On the model's details page, choose the Rule Services tab. Note For more information on rule services, refer to "Business Rules" in this document. 4. In the Rule Services table, choose > beside your target rule service. 5. Choose the + icon above the Rules table. 6. In the New Rule dialog box, specify a rule name, and choose Create. 7. On the New Rule page, define your decision table as follows. 1. Choose the icon to specify condition expression and fixed operator in the Decision Table Settings dialog box. 2. Choose Add Row. 3. In the new row, specify values for condition expression and result attributes. Note Refer to "Business Rules" in this document for detailed decision table settings and examples. 8. When you finish, choose Save. Results The new rule was then saved. After saving the rule, you can choose Activate in the upper-right corner to make the rule take effect immediately or activate it later. 12 P U B L I C
Related Information Business Rules [page 6] 3.4 Edit a Rule Context You can edit an existing rule that has been defined for a GTT model in the GMM app. Procedure 1. Launch the GMM app. 2. On the search page, locate your target model for which you want to edit a rule. 3. On the model's details page, choose the Rule Services tab. 4. In the Rule Services table, choose > beside your target rule service. 5. In the Rules table, choose > beside the rule that you want to edit. 6. On the rule's details page, choose Edit in the upper-right corner. 7. Make your changes and choose Save. Note If the rule has already been activated, a message will remind you to reactivate the rule to apply the changes. You can choose either Activate to reactivate the rule or Deactivate to make it inactive. If you do not activate or deactivate the changed rule, the original rule before the change keeps running and your changes are not applied. The rule status changes from Active to Active with unapplied changes. You can activate it later to apply the changes. P U BL IC 13
3.5 Delete a Rule Context You can delete an existing rule in the GMM app. When a rule is deleted, its design-time rule and run-time rule (if the rule has been activated) are both deleted. Procedure 1. Launch the GMM app. 2. On the search page, locate your target model for which you want to delete a rule. 3. On the model's details page, choose the Rule Services tab. 4. In the Rule Services table, choose > beside your target rule service. 5. In the Rules table, select the rule that you want to delete. 6. Choose the icon. 3.6 Activate or Deactivate a Rule Context You can activate a rule to start running it for the GTT model or deactivate a rule to stop running it. When a rule is activated, it is automatically deployed to the target GTT model and takes effect immediately. A rule can have three statuses as described below: Rule Status Description Active Inactive Indicates that a rule is currently running to trigger actions for the GTT model. You can deactivate an active rule. Indicates that a rule is not running. You can activate an inactive rule. 14 P U B L I C
Rule Status Description Active with unapplied changes Indicates that a rule has been changed since the last activation. The original version of the rule before the change is still running, but the new changes are not applied. You can activate the rule to apply the changes and keep running it, or deactivate the rule to stop running it. Procedure 1. Launch the GMM app. 2. On the search page, locate your target model for which you want to activate or deactivate a rule. 3. On the model's details page, choose the Rule Services tab. 4. In the Rule Services table, choose > beside your target rule service. 5. In the Rules table, select the rule that you want to activate or deactivate. 6. Choose Activate or Deactivate in the upper-right corner. P U BL IC 15
Important Disclaimers and Legal Information Hyperlinks Some links are classified by an icon and/or a mouseover text. These links provide additional information. About the icons: Links with the icon : You are entering a Web site that is not hosted by SAP. By using such links, you agree (unless expressly stated otherwise in your agreements with SAP) to this: The content of the linked-to site is not SAP documentation. You may not infer any product claims against SAP based on this information. SAP does not agree or disagree with the content on the linked-to site, nor does SAP warrant the availability and correctness. SAP shall not be liable for any damages caused by the use of such content unless damages have been caused by SAP's gross negligence or willful misconduct. Links with the icon : You are leaving the documentation for that particular SAP product or service and are entering a SAP-hosted Web site. By using such links, you agree that (unless expressly stated otherwise in your agreements with SAP) you may not infer any product claims against SAP based on this information. Beta and Other Experimental Features Experimental features are not part of the officially delivered scope that SAP guarantees for future releases. This means that experimental features may be changed by SAP at any time for any reason without notice. Experimental features are not for productive use. You may not demonstrate, test, examine, evaluate or otherwise use the experimental features in a live operating environment or with data that has not been sufficiently backed up. The purpose of experimental features is to get feedback early on, allowing customers and partners to influence the future product accordingly. By providing your feedback (e.g. in the SAP Community), you accept that intellectual property rights of the contributions or derivative works shall remain the exclusive property of SAP. Example Code Any software coding and/or code snippets are examples. They are not for productive use. The example code is only intended to better explain and visualize the syntax and phrasing rules. SAP does not warrant the correctness and completeness of the example code. SAP shall not be liable for errors or damages caused by the use of example code unless damages have been caused by SAP's gross negligence or willful misconduct. Gender-Related Language We try not to use gender-specific word forms and formulations. As appropriate for context and readability, SAP may use masculine word forms to refer to all genders. 16 P U B L I C Important Disclaimers and Legal Information
Important Disclaimers and Legal Information P U BL IC 17
www.sap.com/contactsap 2018 SAP SE or an SAP 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 or an SAP affiliate company. 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 or an SAP affiliate company for informational purposes only, without representation or warranty of any kind, and SAP or its affiliated companies shall not be liable for errors or omissions with respect to the materials. The only warranties for SAP or SAP affiliate company 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 and other SAP products and services mentioned herein as well as their respective logos are trademarks or registered trademarks of SAP SE (or an SAP affiliate company) in Germany and other countries. All other product and service names mentioned are the trademarks of their respective companies. Please see https://www.sap.com/about/legal/trademark.html for additional trademark information and notices. THE BEST RUN