Technology Blogs by SAP
Learn how to extend and personalize SAP applications. Follow the SAP technology blog for insights into SAP BTP, ABAP, SAP Analytics Cloud, SAP HANA, and more.
Showing results for 
Search instead for 
Did you mean: 
0 Kudos
SAP IoT’s Rules and Action services are core for automating business processes based on sensor data aka time series data. Since the launch of SAP IoT in March 2019 (named SAP Leonardo IoT at the time) the Rules service enables to create business insights on time series data in form of Events. These Events can then be forwarded via the Actions service e.g. to the SAP Business Suite, e.g. to trigger a replenishment process, a Service process, etc.

In the meantime, we have constantly evolved both, Rules and Action services and we are continuing the development here. An overview of the Action service basics, you can find in these blogs [1] [2] by daniel.kim7.

This blog is more technical and will explain the enhancements of the SAP IoT Actions service from the functional point of view. Please see our other blog articles for example scenarios what insights can be realized using SAP IoT and the technical advancements of the SAP IoT Rules Service.

Action Triggers

For the action service we support now 2 more Trigger types:

  • Geofence Event: You can define Actions on Entry or Exit Events from the Geofencing service. This was released together with the Geofencing Service in April. Geofencing is available under the Early Adopter Care program. Please see here for more details.

  • Custom Event (aka User-defined Event): SAP IoT allows to specify User-defined Events and attach an Event PropertySet to it. With this you can customize what information an Event shall contain. The API reference for the User-define Event configuration you find here. Daniel Kim already introduced this feature in this blog.

For both of these Trigger types it is also possible to define Execution Conditions, that is, depending on the content of the triggering Event, the Action will be executed or not. E.g.:

  • Only trigger the Action of the geo.fence.state = “entry” or “exit”

  • Only trigger an Event if the Event’s error code is between 0 and 999

Further, we enhanced the Action from Rule trigger to support a list of rules. This is useful e.g. in a remote service or remote maintenance scenario, where you want to create a ticket for different anomalities. Instead the need to define an Action per Rule, you define only 1 action for a set of rules where the Action read the details about the anomaly form the Rule’s Event and uses it to create the service or maintenance ticket.

Action Types

Further, Action supports a new Action Type: Send an Event to SAP Enterprise Messaging service. Enterprise Messaging service allows publish/subscribe based service-to-service communication. Many business objects in SAP S/4HANA today use already Enterprise Messaging to publish updates about the objects.

When configuring such an action type, you can select to either send the message into a Topic or a Queue.

You need to have the Enterprise Messaging service configured via a SAP Cloud Cockpit Destination. (Remark: To mark a destination as Enterprise Messaging service, in the destination’s configuration add an “Additional Property” called “sap.enterprise_messaging” and set its value “true”.)

The Action Type “Email Notification” was enhanced by a HTML editor, so you can now send beautiful emails, e.g. in your corporate design.


Accessible Data for Actions

Finally, several new data categories of SAP IoT are now available for usage in the Action messages by using Tokens. To add a Token into a message just type ${ and any letter(s). This will list all available tokens that contain this letter(s). Now the following data categories are available:

  • Thing masterdata

  • Custom masterdata

  • Time series data (lastest value)

  • Thing model reference values, i.e. Threshold values

  • Basic event data, e.g. Event time

  • Geofence event specific data (in case of Geofence event as trigger)

  • User-defined Event data including all assigned Event PropertySet data

  • Other context data like action name, rule ID, etc.

Data & Time Functions

SAP IoT uses the ISO 8601 format timestamps, like 2020-10-29T08:22:33.701Z as result of a ${event.time} token. However, some backend systems expect timestamps separated by data and time. Therefore, we have introduced the ^{dateConverter() function. E.g. this example converts the Event timestamp to a JSON with separate date and time for the CET time zone.


“date”: “^{dateConverter(${<TimeToken>},"dd-MM-yy","CET")}”

“time”: “^{dateConverter(${<TimeToken>},"HH:mm:ss ","CET")}”


Action Execution Logs and Error Descriptions

Finally, when defining actions, logs for debugging are very important. We have improved the Execution Logs for both, Rules and Actions. For Actions, there exist 2 sources of information for debugging.

The Action app has on the Action list page a “Error” column. When clicking on it for an Action, the Error descriptions of the last Action executions are displayed. You can also view more details.

The other option is SAP IoT’s Action and Rule Execution log app. It has several tabs, one for each Scheduled Rules, Streaming Rules, and Actions. At each tab you can see the history of the last executions per service and see if the executions where successful or not. Again, you can view more execution details.



This concludes the overview about the new features available for the Action Service.

Please see also our other blog that gives application examples for using SAP IoT Rules and Actions to generate insights in business scenarios. Of course, these examples leverage the available Action features.