Implementing IoT Integration

Objective

After completing this lesson, you will be able to identify the principles and procedures for configuring integration with IoT devices within the context of SAP Asset Performance Management

Integration With IoT Devices

Key Terms, Used in This Lesson:

  1. IoT Sync: The process of synchronizing data between SAP APM and SAP IoT services. 
  2. REST Gateway: A protocol used for web services that allows for the integration of IoT data into SAP APM. 
  3. Time Series Data: Data collected at different points in time, often used for trend analysis in IoT contexts. 
  4. JWT (JSON Web Token): A compact URL-safe means of representing claims to be transferred between two parties. 
  5. OAuth: An open standard for access delegation, commonly used as a way for users to grant websites or applications access to their information on other websites but without giving them the passwords. 
  6. Model Mapping URL: The URL used to map technical objects to their corresponding models in the IoT service. 
  7. Payload: The part of transmitted data that is the actual intended message. 
  8. IoT Measurement URL: The endpoint to which measurements from IoT devices are sent. 
  9. API (Application Programming Interface): A set of protocols for building and interacting with software applications. 
  10. Sync Job Frequency: Refers to how often the synchronization between systems like SAP S/4HANA and SAP APM occurs. 
  11. SAP IoT APIs: Application Programming Interfaces provided by SAP for interacting with IoT data and services. 

Business Scenario: Integration With IoT Devices

Jessica Martin

For this lesson, Jessica Martin will seek to acquire the skills to leverage time series data, such as sensor data, in SAP Asset Performance Management. She will learn how SAP Asset Performance Management integrates with SAP Internet of Things.

Lesson Overview: IoT Integration with APM

In this lesson, you will learn how to ingest IoT data into SAP Asset Performance Management to a local indicator assigned to a technical object, such as an equipment. As a prerequisite, integration between ERP and SAP APM must be complete and some technical objects have been loaded into the system.

Integration With IoT Devices

Dashboard overview with various management options and their associated metrics. 'Explore Technical Objects' shows a count of 2.41k, 'Groups' have 9, 'Rules' are at 38, and 'Sync Technical Objects – IoT' also at 2.41k. Under Assessment Management, there are 14 Risk and Criticality Assessment Templates, 11 Assessments, 14 Strategy Assessments for Classes, 3 RCM Assessments, and 13 items in the Recommendation Workbench.

Login to SAP APM solution and go to the Explore Technical Objects application.

SAP interface detailing information on a 'Cooling Water Circulation Pump - APM'. It displays categories such as General Data, Structure, Manufacturer Data, and Location Data, with fields for Object Type, Serial Number, Manufacturer, Model Number, and other related equipment details. The interface is part of the 'Explore Technical Objects' function within the platform.

2. Select any technical object you wish to add a local indicator.

The SAP interface for a 'Cooling Water Circulation Pump - APM' with a tab selected for 'Indicators'. The screen indicates that there are no indicators available for the current technical object, and provides an option to create new indicators. The interface is designed for monitoring and managing the performance of technical equipment within the system.

Navigate to the Indicators tab and choose Create.

A form in the SAP interface for creating a local indicator. Fields to be filled include 'Characteristic' with an example entry of OPERATING_HOUR, 'Description', 'Position', 'Category', and various measurement parameters such as unit of measure, maximum, minimum, and target values, along with options for color selection and type of indicator.

Fill out the details for the Local Indicator - note that Characteristic, Position, and Category are mandatory.

The SAP interface shows a section for 'Cooling Water Circulation Pump - APM' under 'Indicators'. A new indicator named 'OPERATING_HOUR' with the description 'Hour Meter Reading(s)' has been created and is listed in the interface, with a confirmation message 'Indicator has been created' displayed at the bottom.

The Local Indicator is now created.

SAP interface dashboard with various asset management options. One section, highlighted with a red box, is titled 'Manage Technical Object Connectivity Issues' with a counter of '20' next to an icon depicting connectivity. It indicates there are 20 issues to be managed within this category

Return to the home screen and navigate to the Manage Technical Object Connectivity app under the Asset Health Monitoring group.

SAP interface for managing technical object connectivity. It displays a single entry for a 'Cooling Water Circulation Pump - APM' with a status indicating 'Not Configured'. The interface provides options for configuration, showing the number of indicators, sync status, and the last attempted sync time for the object.

Search and select the equipment you just added the local indicator for, and press Configure. Toggle the IoT Sync switch. The Gateway selection is important if leveraging the SAP IoT device connectivity APIs as that will determine whether the device is configured for REST or MQTT. If using the Timeseries APIs provided by SAP APM, stay with the default "REST Gateway".

Configuration pop-up window in the SAP Manage Technical Object Connectivity interface. It is asking to configure an IoT device with a toggle switch, indicating the ability to enable or disable the connection. A dropdown menu is available to select the gateway, with a 'Confirm' button to apply changes.

You can see that this indicator is replicated from source "Measuring point" along with Measuring point ID as 93. Now the value of indicator is 76.

Creation of a New Measurement Document in SAP S/4HANA

Lets try to change the value in realtime and see if the data flows to APM in realtime.

Go to measurement document transaction IK11 and open the measuring point 93 

SAP Manage Technical Object Connectivity interface showing a 'Cooling Water Circulation Pump - APM' with one indicator in progress. The sync status is 'In Progress', last attempted sync was on Mar 12, 2023, 10:32 PM, with 'REST Gateway' selected as the gateway. A message at the bottom indicates 'Sync has been triggered'.
The SAP interface for 'Manage Technical Object Connectivity' shows a 'Cooling Water Circulation Pump - APM' with a status indicating 1 indicator as 'Successful'. The last attempted sync is marked on Mar 10, 2023, 10:32 PM, and the gateway used is 'REST Gateway.

Once configuration is complete, select "Sync with IoT" which will sync the APM technical object with SAP IoT. Sync status will change from In progress to Successful

The Time Series

After Successful status of Technical Object in APM UI, time series data can be integrated into SAP APM through several means:

  1. Manually in the Indicators tab on the Technical Object page
  2. Leveraging the SAP APM APIs or SAP IoT APIs
  3. If the indicator is not local but is instead a measuring point integrated from SAP S/4HANA, then a Measuring Document would automatically create the time series value through the SAP Event Mesh interface discussed previously.

Next we will walk through the first two methods of integrating time series data.

SAP interface for 'Explore Technical Objects' showing details for a 'Cooling Water Circulation Pump - APM'. The Indicators tab is open, displaying an 'OPERATING_HOUR' indicator with a 'Create' and 'Add New Value' option available. The indicator has been successfully created and is ready for further configuration or value addition.

To illustrate a manual value, return to the Technical Object page for this equipment. Select the indicator and press Add New Value.

Overlay window on the SAP interface titled 'Add New Indicator Value' for the 'Cooling Water Circulation Pump - APM'. It contains fields to input a new value and a date and time. The interface is designed for users to update and manage indicator readings for technical equipment.

Fill out the page and hit Save. The indicator will then be updated with this value.

The SAP 'Explore Technical Objects' interface shows an indicator for 'OPERATING_HOUR' with a newly added value. The interface indicates the successful update of the indicator with a value and provides further options such as edit, delete, and configure for the 'Cooling Water Circulation Pump - APM.
A graph in the SAP 'Explore Technical Objects' interface showing the hour meter reading trend for a 'Cooling Water Circulation Pump - APM'. The horizontal line graph indicates a consistent value over time, with a tooltip revealing the most recent reading.

After some time, the Indicator Monitoring chart will be updated with this value as well.

Manual time series entry is sufficient in many scenarios, especially when data is manually collected. However, times series is frequently generated by sensors and here we want to leverage an API to bring this data into the system. This will show an example on how using a REST client, like Postman, can bring data in. However, in an actual project, an integration tool, such as SAP Plant Connectivity or SAP Data Intelligence can be used.

In order to use SAP APMs API, you will need two things:

  1. The X-API-KEY which can be obtained on request through an incident with SAP. This can be done by creating a ticket in the component APM-OPS-SERV with priority Medium. Provide the following details:
  2. Subaccount Sub-domain
  3. Subaccount ID
  4. Subaccount API
  5. Email ID (to send the key)
  6. The service key created when creating a service instance in the BTP subaccount. The APIs are secured via oAuth 2.0 and the client id and client secret are contained in the service key.

Note - Each API request then would need to have two headers:

  • X-API-KEY with the API key as the value.
  • Authorization with Bearer <token> as the value. The <token> is fetched by leveraging the client ID / client Secret / and authorization URL from the service key.
SAP BTP Cockpit showing the 'Space: apm - Service Instances' section. It lists a single service instance named 'apm-001' for the SAP Asset Performance Management service with the plan 'standard' and status 'Created', indicating successful instance setup.
API request header configuration with various keys and values. Notably, there are two fields highlighted: 'X-Auth-Key' with its value redacted for security, and 'Authorization' with a 'Bearer [token]' value, also redacted. These headers are critical for ensuring secure API communication.

In order to successfully create time series data via the SAP APM APIs, we need to leverage two APIs.

  1. Indicator API to fetch the internal IDs of the indicator.
  2. The Timeseries API to create the time series values.
JSON format credential detail with various service endpoint URLs for an API. One of the service endpoints for 'IndicatorService' is highlighted, indicating the specific URL to access this service within the API's structure.

To fetch the indicator definition, make a request to the indicator service. Leverage the "indicators" service URL found in the APM service key. You can also add an oData filter string to reduce the sample set to the technical object you need. An example call would look like this:

https://api-apm.prod.apimanagement.us10.hana.ondemand.com/IndicatorService/v1/Indicators?$filter=technicalObject_number eq '217100092'

API testing interface with a response body in JSON format displayed. It includes an array of objects detailing 'TechnicalIndicator' information with various attributes such as 'uuid', 'value', 'valueId', 'creationTime', and others. Some attributes contain specific data while others are null, reflecting a typical structure of a response from a REST API call.

Creating Timeseries Data

Next - we use the timeseries API, along with the data retrieved from the indicators API to create timeseries data. Here, we are leveraging a POST API to the timeseries service, where the payload is as follows:

Code Snippet
123456789101112131415
{ "SSID": "", "technicalObjectType": "", "technicalObjectNumber": "\", "categoryName": "" "positionID": "", "values": [ { "characteristicsInternalId": "\", "value": "", "time": "2024-03-01T16:00:00.0000000Z" } ] }

Note that all of the fields, with the exception of the 'value' and 'time' fields are obtained from the result of the Indicator API. A complete payload example would look like this:

Code Snippet
123456789101112131415
{ "SSID": "S4HCLNT100", "technicalObjectType": "EQUI", "technicalObjectNumber": "217100092", "categoryName": "M", "positionID": "24aa638b97194cb8b9d0cf4c2a46eb95", "values": [ { "characteristicsInternalId": "53", "value": "45", "time": "2024-03-01T16:00:00.0000000Z" } ] }

If successful, you should receive a "201 Created" response.

API credentials interface displaying JSON data with various service endpoints. The 'timeseries-service' endpoint is highlighted, providing the URL to access time series data within the API. At the bottom, there is a 'html5-apps-repo' object containing an 'app-host-id', further indicating structured data for API configuration and connectivity.
API response in JSON format displayed in an API testing tool. It shows an array of measurements with their respective 'technicalEquipmentNumber', 'characteristicInternalId', 'valueId', and 'value'. The data entries have timestamps indicating when each measurement was recorded.

Demonstration Videos

Additional Resources

Laptop showing the SAP Asset Performance Management interface on its screen. The 'Asset Health' section is open, displaying an 'About' section with version and support pack details, a 'Documents' section with entries for using Service Key and Problem Overview, and a 'Business Tags' section related to Asset Performance Management.

Obtaining X-API-KEY

Asset Health APIs on SAP Business Accelerator Hub

https://api.sap.com/package/SAPAssetPerformanceManagementAssetHealth/overview

Personal Reflection

Think about a time when you had to learn a new technology or process that was outside of your usual expertise, much like integrating IoT devices with SAP Asset Performance Management. How did you handle the learning curve, and what strategies helped you grasp the concepts and procedures?

Expert Response

Expert Response to Personal Reflection Question:  

Tackling new tech, like IoT integration with SAP APM, is a bit like learning to swim. You start in the shallow end-getting the hang of what IoT devices do and how they talk to each other using APIs. It's like getting comfortable in the water before you try to swim. 

Next, you dive into specifics, learning how these devices mesh with SAP APM. It's like swimming laps-practicing the strokes until they feel natural. And just as swimmers often learn better with a coach or a team, I found that working through challenges with colleagues or sharing my knowledge made the learning stick. 

So, when we talk about setting up IoT in SAP APM, from syncing equipment to sending data, it's a process where each step builds on the last. My past experiences remind me to take it step by step, ask for help when I need it, and share what I learn along the way. It's about being patient and persistent, and that's how the pieces fall into place. 

Conclusion

Objective: Master the process of integrating IoT data for technical objects within SAP Asset Performance Management (APM), ensuring that equipment data from SAP S/4HANA is effectively synchronized.

Key Points:

  1. Preparation:
    1. Confirm that equipment from SAP S/4HANA is synced with SAP APM.
    2. Access the 'Explorer Technical Object Application' within SAP APM.
  2. Technical Object Sync:
    1. Locate the synced technical object from SAP S/4HANA.
    2. Check the sync job frequency to ensure the object appears in APM.
  3. Indicator Creation and IoT Synchronization:
    1. Generate new local indicators for a technical object.
    2. Utilize the 'Sync Technical Objects - IoT' function to link technical objects with SAP IoT.
  4. Configuring IoT Data Ingestion:
    1. Validate successful sync status for the technical object and indicators.
    2. Use the 'Add New Value' feature to input time series data for equipment indicators.
  5. SAP IoT API Interaction:
    1. Retrieve JWT tokens using APM authentication URLs.
    2. Utilize model-mapping URLs to get mapping IDs for technical objects.
    3. Post time series data to indicators through the IoT Measurement API.
  6. Verifying Data Integration:
    1. After posting data, check the APM UI to ensure that the indicator values reflect the new inputs.
    2. Confirm data reflection in SAP APM to ensure end-to-end data integration.

Outcomes: Participants will gain the ability to integrate and validate IoT data within SAP APM, enabling enhanced monitoring and performance analysis for technical objects. This ensures that equipment data remains up-to-date, providing a comprehensive view of asset health and performance.

Log in to track your progress & complete quizzes