Skip to Content
Technical Articles

How to create a service request in SAP Cloud for Customer using an SAP Leonardo IoT Action

SAP Leonardo IoT has recently introduced several features to provide to the user a more complete selection of functionalities, a more complete and simple integration with the other SAP products or with 3rd party services.

One of the integrations that is now available with SAP Leonardo IoT is the Service Ticket creation in an SAP Cloud for Customer system.


The scenario:


John is the persona. He is a driver of an IoT enabled refrigerated van rented by the company ACME.

The vans of the company are able to measure the actual temperature (in real time) of the fridge. Each van is connected with a mobile SIM card to the internet and sends the data to their instance of SAP Cloud Platform Internet of Things and SAP Leonardo IoT, where they have mapped their digital twins.

The ACME company has also been subscribed to SAP Cloud for Customer to be able to manage the vans and monitor their status.

The aim is to have an efficient plan of maintenance to reduce the downtime of their vehicles, which saves ACME a lot of money.


This is the communication flow used for this scenario:

In this scenario, ACME is currently monitoring the status of the temperature of the fridges to detect any failure and promptly repair them after the creation of a service request ticket in the Cloud for Customer system.

In particular each van is sending the current value of measurement of the temperature to the IoT Gateway Cloud MQTT from where the data is forwarded to the tenant of SAP Leonardo IoT.

A rule is in place that evaluates if the current value of the temperature is over a certain threshold (e.g. 10°) which usually means that the fridge is currently out of order.

In this situation an event is generated by the rule engine and an action linked to that rule is triggered.

This action through the native integration with Cloud for Customer will create a new service request (ticket) to efficiently plan the repair of the fridge.

Let’s see in action how to technically integrate the creation of a new Cloud for Customer ticket from SAP Leonardo IoT.

For the following steps we assume that the secure connection to the IoT Gateway Cloud MQTT has already been realized and configured and the connection between SAP Leonardo IoT and SAP Cloud Platform Internet of Things has been created.

In this scenario we are also assuming that data are already ingested correctly by the systems.


Configure the connection with Cloud for Customer


In order to configure the Cloud for Customer connection, it is required to create a new Destination within the SAP Cloud Platform cockpit.

To complete this step, you need to open into the Cloud Platform cockpit, your Cloud Foundry subaccount, then press “Destination” in the menu on the left, under “Connections” and create a new Connection with the following details:


For example, this is our configuration:


Create a Rule


Now within your SAP Leonardo IoT Fiori Launchpad open the tile Rule Contexts to create a new rule context related to the particular Thing Type that represent the digital twin of the fridge-van.



After the creation, open the Rules tile in the Fiori launchpad and create a New Rule of type “Streaming”.

Specify a Name for your rule and then go to the tab “Editor” and select the Rule Context created in the step before to apply the rule to the desired Thing Type.

Our Thing has a Property Set of type Measured Values called Temperature modeled into the Thing Properties Catalog. This set of measures has a property named Temperature.

Now we can add the condition that should trigger the rule:

The condition will be “Temperature of the Temperature is greater than 10”, which means the fridge is out of service.

The first “Temperature” in the condition is the property name, the second is the property set name.

‘TemperatureCritical’ will be the name of the event that is created by the rule; his its severity will be ‘Medium’.



Save the rule and then activate it. In the list of currently existing rules, the newly created rule must appear as Active, otherwise no event will be created.


Define the action


The next step is the action that will be triggered when the condition of the rule is positive.

Open the Actions tile of SAP Leonardo IoT Fiori Launchpad and press “New” to create a new action.


  • a name for the action, e.g. Create_C4C_Service_Ticket
  • triggered by “Event from Rule”
  • As rule select the rule created before
  • Action Type HTTP
  • In the drop down of the destination, select the destination you have created in your Cloud Cockpit
  • For the request body put a JSON object such as:
    "Name": "Van fridge not working for ${}",
    "ServicePriorityCode": "1",
    "ProductID": "10006550",
    "CauseServiceIssueCategoryID": "",
    "DataOriginTypeCode": "1",
    "ObjectServiceIssueCategoryID": "",
    "ProcessingTypeCode": "SRRQ",
    "SalesTerritoryID": "4",
    "InstallationPointID": "0000000000000000000000000000000000000201",
    "InstalledBaseID": "",
    "SerialID": "19",
    "ServiceIssueCategoryID": "PS",
    "ServiceRequestClassificationCode": "1",
    "ServiceRequestUserLifeCycleStatusCode": "1",
        "Description": "${}",
        "ProductID": "10006550"


The other parameters can be kept to default value:

  • Invocation Type: Auto
  • Method: POST
  • Trigger subsequent event: checked
  • Response Payload Type: XML


Consider that the ProductID and SerialID must already exist in your C4C system and the product must be already part of the registered products. The final configuration of the Action should be something like the following:



The result


John is currently driving the van with the license plate number AE234KM which is currently sending data to the back-end. Unfortunately, today the fridge has a failure and the temperature sent to IoT Service is greater than 10 °C.

It is identically the same of the external temperature, which today is around 16 °C.

Under these circumstances the Rule triggering the creation of the event and also the Action will be currently executed. In our C4C portal a new ticket has been created, that will be after handled by ACME employees.

This is how the final results looks like in C4C:




In order to have a smarter (creation of the tickets and to prevent duplicates, it’s strongly suggested to configure the Execution Mode of the rule defined before:



In this blog post we have shown how SAP Leonardo IoT permits an easy creation of a service ticket in SAP Cloud for Customer.

If you are interested to send the message, created by the action, to another or 3rd party supported system you have to create a different Destination within the SAP Cloud Platform cockpit and use a different body of the request.

Be the first to leave a comment
You must be Logged on to comment or reply to a post.