Skip to Content

This short blog will show how to call an OData API on an SAP S/4HANA Cloud (S/4HC) system using the client tool Postman.  The steps in this blog exist in several places online already around the SAP ecosystem, but I wanted to provide another concise example in a 101 type fashion specifically for S/4HANA Cloud using a client tool (Postman).  There is already a great blog series that shows how to test API services using the SAP API Hub as well and can be found here.

In this blog, we’ll retrieve business partner data for a customer master record using an OData service in Postman.

Although interface development will typically occur on an integration platform such as SAP Cloud Platform Integration (CPI), it is often beneficial to interact with the data for testing purposes in order to evaluate payloads, returned fields, etc.  In this blog, we’ll use a powerful API testing tool from Chrome called Postman to test the Business Partner API.

The first step is to identify the API that you want to use from the SAP API Hub–https://api.sap.com.  As already mentioned, we’ll use the OData Service for Business Partner.

We need to configure the availability of the API on our S/4HANA Cloud system.  This is done by creating a communication user, communication system and ultimately a communication arrangement.  The required communication arrangement for the API can be found on the documentation tab of the service in the API hub:

Refer to this link on setting up the communication arrangement.  It’s important to note that only the configured user on the communication arrangement can access the API.  Even end users with BR_ADMINISTRATOR cannot access the service.  So for example, only user SAPCOM0008 can be used to access the service.

 

The next step is to identify the exact URL of the service in the S/4HC system.  This can also be found on the Communication Arrangement under the “Inbound Services” section:

Now it is time to call the service in Postman.

Although you can get the required entities from API hub, you can also append /$metadata to any OData service to retrieve the service description.  I find this beneficial to not only test that connectivity (username/password) is working but also to explore the service itself.

In Postman,

  1. enter the URL from the communication arrangement and append $metadata
  2. set the authorization type to Basic Auth, and enter the username and password
  3. click “Send”button

The metadata file for the service is returned.

See this link for more info on the file itself: Understanding the $metadata file

From here, you can start to interact with the service.  For example, to retrieve the business partner with id 1000000, you can enter the URL: https://my######-api.s4hana.ondemand.com/sap/opu/odata/sap/API_BUSINESS_PARTNER/A_BusinessPartner(‘1000000’)

If you want to see certain navigational entity data as well, you can use the expandto option.

For example, here is the same call but with the BusinessPartnerAddress expanded:

 

There is a lot that you can do querying OData services, to learn more about the options go here.

That’s all for now–in the next blog we’ll explore updating data in S/4HC for testing purposes using Postman.

Best Regards,
Marty

To report this post you need to login first.

3 Comments

You must be Logged on to comment or reply to a post.

  1. Sijin Chandran

    Hello Marty,

    Can we do this using the S/4 Hana Cloud trial tenant ?

    am not getting any valid response from the server.

    Can you please suggest where am missing.

    Thanks,

    Sijin

    (0) 
  2. Sijin Chandran

    If I am missing on the below mentioned step illustrated by you,

    Refer to this link on setting up the communication arrangement.  It’s important to note that only the configured user on the communication arrangement can access the API.  Even end users with BR_ADMINISTRATOR cannot access the service.  So for example, only user SAPCOM0008 can be used to access the service. 

    then can you please tell me how to get this done in S4 HANA Trial Cloud account.

    Thanks,

    Sijin

    (0) 
    1. Marty McCormick Post author

      Hi Sijin

      This blog is intended for SAP S/4HANA Cloud not SAP Cloud Platform (which I think is what you’re referencing when you say trial account).

      Thanks,
      Marty

      (0) 

Leave a Reply