Skip to content

ROBROICH/SAP_AND_AZURE_IOT_DEMO

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 

Repository files navigation

Introduction to the SAP and Azure IoT Demo

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

Demo high level overview

Demo scenario and basic story line

  • 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

Demo implementation

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

Demo flow

Raspberry PI emulator & Notifications with Azure Logic Apps

  • 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)

Access to public SAP demo system

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"
}

Logic App implementation

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

GET Request

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

GET Request

POST Request

  • 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'], ',', ';')}

Post request

Run the demo

  • Run the logic app
  • Run the Raspberry emulator. Wait until the emulator sends an alert, when temperature is >30°
  • The logic app gets executed

Logic App

Check data in excel

After the logic app got executed, the data is stored in SAP and available for consumption by business users.

Run the demo

Connect to Odata datasource

URL:  https://sapes5.sapdevcenter.com/sap/opu/odata/iwbep/GWSAMPLE_BASIC/SalesOrderSet

Excel screen

Display results:

Result

Display data in PowerBI

Next to Excel, the OData connector of PowerBI can be used to display the data:

PowerBI

Demo finished!

Overview presentation