Key Terms, Used in This Lesson:
- IoT Sync: The process of synchronizing data between SAP APM and SAP IoT services.
- REST Gateway: A protocol used for web services that allows for the integration of IoT data into SAP APM.
- Time Series Data: Data collected at different points in time, often used for trend analysis in IoT contexts.
- JWT (JSON Web Token): A compact URL-safe means of representing claims to be transferred between two parties.
- 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.
- Model Mapping URL: The URL used to map technical objects to their corresponding models in the IoT service.
- Payload: The part of transmitted data that is the actual intended message.
- IoT Measurement URL: The endpoint to which measurements from IoT devices are sent.
- API (Application Programming Interface): A set of protocols for building and interacting with software applications.
- Sync Job Frequency: Refers to how often the synchronization between systems like SAP S/4HANA and SAP APM occurs.
- SAP IoT APIs: Application Programming Interfaces provided by SAP for interacting with IoT data and services.
Business Scenario: Integration With IoT Devices

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

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

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

Navigate to the Indicators tab and choose Create.

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

The Local Indicator is now created.

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

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

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


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:
- Manually in the Indicators tab on the Technical Object page
- Leveraging the SAP APM APIs or SAP IoT APIs
- 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.

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

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


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:
- 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:
- Subaccount Sub-domain
- Subaccount ID
- Subaccount API
- Email ID (to send the key)
- 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.

![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. 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.](https://learning.sap.com/service/media/topic/ce6e529e-eab3-4fe6-98f6-460225344dea/topic/ce6e529e-eab3-4fe6-98f6-460225344dea/IAM160_2402_en-US_media/IAM160_2402_en-US_images/IAM160_2402_U2L5_027.png)
In order to successfully create time series data via the SAP APM APIs, we need to leverage two APIs.
- Indicator API to fetch the internal IDs of the indicator.
- The Timeseries API to create the time series values.

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'

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:
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:
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.


Demonstration Videos
Additional Resources

Asset Health APIs on SAP Business Accelerator Hub
https://api.sap.com/package/SAPAssetPerformanceManagementAssetHealth/overview

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