Leveraging SAP DM OData Service to export Manufacturing Data

Objective

After completing this lesson, you will be able to understand the capabilities and limitations of the SAP Digital Manufacturing OData Service.

What is the SAP Digital Manufacturing OData Service?

Introduction

SAP Digital Manufacturing’s MDO OData Service allows users to read and filter MDO data to create meaningful and data-driven applications. These APIs are particularly useful for the following:

  • Extracting data for reporting and dashboards such as SAP Analytics Cloud (SAC).
  • Supporting analyses like Overall Equipment Effectiveness (OEE) calculations.
  • Replicating the data into other systems for advanced processing (for example, Process Mining with SAP Signavio).

The MDO Service responds with up to 5,000 records per call. If more records exist, an API response includes a link to navigate to the next dataset. Please consider the limitation that SAP Digital Manufacturing does not guarantee that the transactional data will be immediately available. As a result, these APIs should only be used for read-only scenarios and not in cases with process interlocking.

Available API Endpoints

  • Test Environment Endpoint:

    https://api.test<data-center-ID>.dmc.cloud.sap

  • Productive Environment Endpoint:

    https://api.<data-center-ID>.dmc.cloud.sap

The data-center-ID can be retrieved from your SAP Digital Manufacturing tenant URL (for example, eu20, us10).

Core API Functionality

To effectively use the APIs, you must retrieve and manipulate data using specific query parameters. Therefore, before working with MDO data, it is recommended to retrieve the $metadata to understand available fields and their structure. It provides the technical names of objects and fields which can be used for filtering.

This figure illustrates a data flow process involving SAP Analytics Cloud, SAP Datasphere, Signavio, and Custom Consumer.

Metadata URL (Test Env.):

https://api.test.<data-center-ID>.dmc.cloud.sap/dmci/v2/extractor/$metadata

The second important topic, before you can retrieve any data using the OData API is authentication. Authentication is required to access the MDO data through the API call. We recommend using one of the following authorization types:

  • OAuth 2.0 (Client ID and Client Secret): Persistent authorization credentials.

    Use these credentials from the Service Key of your SAP BTP Digital Manufacturing tenant (recommended solution)

  • Bearer Token (JOT-Token): Temporary authorization credentials.

    Retrieve the JWT-Token by logging in to your SAP DM Tenant, changing the URL to the following: https://...web.dmc.cloud.sap/jwt and copying the value of "accessToken"

Best Practices when working with the SAP Digital Manufacturing MDO OData Service

The following are the best practices when you are working with the SAP Digital Manufacturing MDO OData Service:

  • Apply $filter to narrow down datasets, reducing the number of records returned
  • Leverage links ($expand) for paginated responses when working with linked MDOs
  • Use the OData Service only for reporting scenarios and not for time critical process interlocking, as MDOs do not guarantee real-time data synchronization
  • Ensure that your OAuth 2.0 credentials and JWT tokens are securely stored and refreshed when expired

Key OData Query Parameters

Utilize the parameters below to refine your queries and extract the most relevant data. The example URL applies to the data center EU20, if your DM Tenant is hosted on another data center, please consider changing the data center ID in the URL.

  • Data Selection: Retrieve specific columns from the MDO object with $select.

    For example:

    • Retrieve PLANT, MATERIAL, and MATERIAL_VERSION from the MATERIAL table.
    • https://api.test.eu20.dmc.cloud.sap/dmci/v2/extractor/MATERIAL?$select=PLANT,MATERIAL,MATERIAL_VERSION
  • Filtering Data: Apply conditions to retrieve filtered data with $filter.

    For example:

    • Retrieve the rows from the ORDER table, where PLANT is '1010’ and MFG_ORDER is '11110000’
    • https://api.test.eu20.dmc.cloud.sap/dmci/v2/extractor/ORDER?$filter=PLANT eq '1010' and MFG_ORDER eq '11110000’
  • Retrieve Count: Get the total number of MDO objects in a tenant with $count.

    For example:

    • Count the Plants in the tenant.
    • https://api.test.eu20.dmc.cloud.sap/dmci/v2/extractor/PLANT/$count
  • Sorting Results: Sort the dataset by a specific column with $orderby.

    For example:

    • Sort the data entries descending by the parameter CREATED_AT (ascending is default)
    • https://api.test.eu20.dmc.cloud.sap/dmci/v2/extractor/MATERIAL?$orderby=CREATED_AT%20desc
  • Add Linked Data: Extend data retrieval by including linked objects with $expand.

    For example:

    • Retrieve the orders within the data of the linked SFCs
    • https://api.test.eu20.dmc.cloud.sap/dmci/v2/extractor/ORDER?&$expand=SFCS
  • Combining Parameters: Use multiple query parameters within the same Service call with $filter and $select.

    For example:

    • Filter by Plant 1010 and select the columns PLANT, MATERIAL, and MATERIAL_VERSION
    • https://api.test.eu20.dmc.cloud.sap/dmci/v2/extractor/MATERIAL?&$filter=PLANT eq '1010'&$select=PLANT,MATERIAL,MATERIAL_VERSION