This demo is a basic extension of an existing Azure IoT tutorial to demonstrate SAP connectivity leveraging a public SAP Gateway demo system.
The intention is to have a repeatable and public SAP and Azure IoT demo based on:
-
Azure Raspberry emulator
-
Azure IoT Hub and Logic App
-
Public SAP demo system
-
Imagine the Raspberry Emulator as IoT device used in shipping of heat-sensitive vaccines
-
If the temperature is measured above 30°, the vaccine is damaged and must be replaced
-
To replace the vaccine, a sales order is automatically created in SAP ECC in case the measured temperature is above 30°
-
For excel users the current sales order SAP ECC will be displayed in Excel
The following steps are required to implement the demo:
- Raspberry PI emulator
- Notifications with Azure Logic Apps
- Get access to public SAP system
- Adjust Logic-App
- Show sales order in Excel or Power BI
-
Implement Raspberry PI emulator tutorial (Link)
-
Implement IoT remote monitoring and notifications with Azure Logic Apps connecting your IoT hub and mailbox tutorial (Link) Finish the paragraph “Configure the logic app trigger” and continue with the GitHub tutorial (here)
-
Prerequisite: S-User or user for SAP Community. In case required sign-up for a user.
-
Get access to SAP Gateway demo system(Link)
-
Optional: Get familiar with GWSampleBasic Odata Service (Visual-Code REST Client)
Coding for VSCode Restclient
# sapes5.sapdevcenter.com
# Authorization: YOURUSERNAME:YOURPWD
# @name login
GET https://sapes5.sapdevcenter.com/sap/opu/odata/iwbep/GWSAMPLE_BASIC/$metadata HTTP/1.1
Authorization: Basic YOURUSERNAME:YOURPWD
X-CSRF-Token: fetch
@authToken = {{login.response.headers.X-CSRF-Token}}
# @name salesOrder
POST https://sapes5.sapdevcenter.com/sap/opu/odata/iwbep/GWSAMPLE_BASIC/SalesOrderSet HTTP/1.1
Authorization: YOURUSERNAME:YOURPWD
X-CSRF-Token: {{authToken}}
Content-Type: application/json
{
"SalesOrderID" : "0500000011",
"Note" : "SAP MFST DEMO 1234",
"NoteLanguage" : "E",
"CustomerID" : "0100000010",
"CustomerName" : "SAP",
"CurrencyCode" : "EUR",
"GrossAmount" : "99",
"NetAmount" : "100",
"TaxAmount" : "200",
"LifecycleStatus" : "N",
"LifecycleStatusDescription" : "New",
"BillingStatus" : "",
"BillingStatusDescription" : "Initial",
"DeliveryStatus" : null,
"DeliveryStatusDescription" : "Initial",
"CreatedAt" : "2012-10-10T00:00:00",
"ChangedAt" : "2014-10-10T00:00:00"
}
Remark: Without the support of Bartosz Jarkowski the demo would end here. Further details here.
Finish the tutorial until : Configure the logic app trigger / 5. Create a service bus connection. Instead of creating an SMTP connection, create a HTTP GET Action
URI: https://sapes5.sapdevcenter.com/sap/opu/odata/iwbep/GWSAMPLE_BASIC/SalesOrderSet/
Header parameter:
Connection: keep-alive
X-CSRF-Token: fetch
Authentication: Basic
User/Pwd: Credentials for SAP demo system
- Append a HTTP POST Action to the GET-request
- The logic app creates an SAP sales order via the Odata Gateway
- Caution! The formula @outputs('GET') refers to the name of the previous HTTP element. Please be aware of the references.
Headers:
"Connection": "keep-alive",
"X-Requested-With": "XMLHttpRequest",
"x-csrf-token": "@outputs('GET')['headers']['x-csrf-token']"
Body:
{
"BillingStatus": "",
"BillingStatusDescription": "Initial",
"ChangedAt": "2014-10-10T00:00:00",
"CreatedAt": "2012-10-10T00:00:00",
"CurrencyCode": "EUR",
"CustomerID": "0100000000",
"CustomerName": "SAP",
"DeliveryStatus": null,
"DeliveryStatusDescription": "Initial",
"GrossAmount": "2000",
"LifecycleStatus": "N",
"LifecycleStatusDescription": "New",
"NetAmount": "100",
"Note": "SAP and Azure in Berlin",
"NoteLanguage": "E",
"SalesOrderID": "0500000011",
"TaxAmount": "200"
}
Cookie:
@{replace(outputs('GET')['headers']['Set-cookie'], ',', ';')}
- Run the logic app
- Run the Raspberry emulator. Wait until the emulator sends an alert, when temperature is >30°
- The logic app gets executed
After the logic app got executed, the data is stored in SAP and available for consumption by business users.
Connect to Odata datasource
URL: https://sapes5.sapdevcenter.com/sap/opu/odata/iwbep/GWSAMPLE_BASIC/SalesOrderSet
Display results:
Next to Excel, the OData connector of PowerBI can be used to display the data: