SAP IoT-enabled replenishment helps connecting digital and physical world by using IoT devices

This blog will tell you how a replenishment scenario will work smoothly by using SAP IoT.

Before going into details, Please watch the SAP IoT-enabled Replenishment video on Youtube to get a better high-level overview on what exactly this scenario is about.

SAP IoT-enabled Replenishment

IoT-enabled replenishment helps connecting digital and physical world by using IoT devices. Many companies in the food processing, chemical, pharmaceutical, and other industries produce material and store them in either Silos or Containers (not to be confused with shipping containers). Material in containers are then shipped to their customers. Companies miss out on the usage level of material in Silos or Containers and face challenges to refill based on the ad hoc requests from customers. Generally, at customer site, traditional way of stock keeping is used which involves conventional methods such as weigh bridges, manual inspection etc. Not only is this prone to mistakes/mismatches, but is also an inefficient way of tracking stock. The stock also doesn’t depict the current levels but there is always a lag between the readings and update to the system, this causes a lag in the stock level visibility.

Another issue companies face due to the lack of data is to maintain more inventory. Not having data on consumption patterns at customer locations results in companies increasing inventory on their side to ensure readiness to demand. This becomes more relevant for big companies.

Goal of the replenishment scenario

Let’s assume a manufacturer produces beverages and uses silos. We will show how a purchase order can be created automatically in SAP S/4HANA Cloud as soon as the fill level of a silo falls below 30%.

Integrate SAP S/4HANA Cloud with SAP IoT

To get a purchase order created automatically in SAP S/4HANA Cloud as soon as a fill level of a silo is below a threshold, the systems need to be integrated.

Therefore a communication arrangement based on the purchase order API in SAP S/4HANA Cloud needs to be created. The communication scenario is SAP_COM_0053 (Please look into the SAP API Business Hub for more information).

After creating a communication arrangement in the SAP S/4HANA Cloud, a destination in the BTP Cockpit is also necessarily needed. The URL for the destination is given in the communication arrangement which was created before (e.g. https://my…..api.s4hana.ondemand.com/sap/opu/odata/sap/API_PURCHASEORDER_PROCESS_SRV). Please add following part behind the URL: /A_PurchaseOrder. The complete URL would look like this: https://my…..api.s4hana.ondemand.com/sap/opu/odata/sap/API_PURCHASEORDER_PROCESS_SRV/A_PurchaseOrder.

For the communication, a CSRF token is also needed. Therefore please fill in the additional properties with:

  • sap.iot.fetchXcsrf – true
  • sap.iot.XcsrfURL – https://my….-api.s4hana.ondemand.com/sap/opu/odata/sap/API_PURCHASEORDER_PROCESS_SRV/$metadata

Finally the destination will look like in the following illustration:

Maintain Basic Data in the Thing Modeler in SAP IoT

When it comes to managing physical assets (buildings, vehicles, machines of all kinds), it is obvious that one of the major preparatory tasks is defining the things you are interested in, that is, the digital twins of each of your assets. Once you have set up all these things within SAP IoT, you have laid the foundation of your own share of the Internet of Things. That’s why you need to maintain basic data in the Thing Modeler application. For more information on what is the Thing Modeler or how to create Thing Types or Things, please follow this instruction on the SAP Help Portal.

An example of how a Thing Type could look like for a replenishment scenario based on Silos is shown below (Thing Type: Silo_T500). A thing type describes the inner structure of a group of things of the same kind. The major aspect of a thing type is the set of properties that all things derived from that type have
in common. These properties are collected in reusable sets of properties called Property Sets. These property sets can contain basic data, measured as well as calculated values, and status information.

An example of how a Thing could look like for a replenishment scenario based on Silos (Measured values) is shown below. Now, let’s look at the Things configured for Silo_T500 Thing Type. A thing in the Thing Modeler is what is often referred to as the “digital twin” of any kind of a real-world object, or a virtual representation of a physical asset. A thing is almost completely defined by the settings that are in effect for the thing type from which it has been derived. Only a few (but nevertheless important) settings can be made directly for one individual thing.

In the example above, The configured measures will show the respective latest value ingested.
You can see that the upper threshold is 6.6 meter, and the current value is 8 meters.

Define Rules & Actions in SAP IoT

With rules, you can leave it up to the system to permanently keep an eye on each and every sensor data point coming in. However, actions are defined to do some “action” if the defined rule is violated. In this replenishment scenario, the fill level of each silo is getting measured. In this example a event creation rule is created in the app Rule Projects App:

The Rule Editor tab is where the rule is configured through an “If Then” condition. Here, we set a threshold level for fill level data. As per our configuration, if the fill level of the silo falls below the threshold of 30%, then an event will be triggered.

For more information on the rule for this use case, please look into the Replenishment demo (accessible for partners: Search for 17431) in the SAP demo store.

Next, an action in the app Actions needs to be defined which will be triggered as soon as soon as a predefined rule is fulfilled.

The goal is that a purchase order will be created in SAP S/4HANA Cloud automatically as soon as the fill level of a silo falls below 30% (defined in the Rules part above).

By creating a new action, please fill in all necessary information in this section. It will look like in the following figure:

In the Destination field under the HTTP Information part, please select the destination which was defined at the beginning of this blog post in the SAP IoT system.

Furthermore, the Request body needs to be filled. To find out how the scheme view of the Purchase Order API looks like, please have a look into the details of the Purchase Order API on the SAP API Business Hub. Now, you can adjust the code with your defined basic data defined in your Thing Type (for more information on how to use tokens in Actions, please read here).

Result

As soon as the rule which was created gets violated, a purchase order will be created automatically in the SAP S/4HANA Cloud system.