Skip to Content
Author's profile photo Divya Mary

Part 1: Discover, Explore and Consume SAP S/4HANA Cloud APIs in SAP API Business Hub

SAP API Business Hub is the central catalog of all SAP and partner APIs for developers to build sample apps, extensions and open integrations with SAP.  In this blog, we would show case the discovery, explore and consumption of the SAP S/4HANA Cloud APIs to build a Fiori Application.

Discover and Explore APIs in SAP API Business Hub

SAP applications, platforms, and business networks continue to open up through APIs – to facilitate ecosystem-driven innovations and seamless integration – through the SAP API Business Hub.

  • To Discover, Explore and find the right APIs for your business use case navigate to https.api.sap.com
  • Click on the APIs tile to discover APIs from SAP SuccessFactors, SAP S/4HANA Cloud, Concur, SAP Leonardo Machine Learning, SAP Leonardo IoT and 300+ more APIs.

  • In the Highlights region, all Featured APIs from the SAP API Business Hub team & the latest published APIs are shown.

  • Click on the All tab to view all SAP APIs from SAP SuccessFactors, SAP Hybris Cloud for Customer, Concur, SAP Fieldglass,SAP Leonardo Machine Learning, SAP Leonardo IoT and select SAP Partners.

  • In this blog, we are focusing on the APIs from SAP S/4HANA Cloud and therefore click on the SAP S/4HANA Cloud featured tile to view all the APIs from SAP S/4HANA Cloud.

  • Any upcoming notification from SAP S/4HANA Cloud is shown in the Overview page.

 

  • Additional documentation on integration with SAP S/4HANA Cloud APIs are available under DOCUMENTS tab. Any Feedback, comments can be shared via comments/rating on the RATINGS tab
  • To view all the APIs from SAP S/4HANA Cloud, click on the ARTIFACTS tab.

 

  • S/4 HANA Cloud contains a mix of OData and SOAP APIs. OData APIs are useful in building digital application like the Fiori application or the mobile application. SOAP service are useful in system to system integration scenarios.
  • Filter Artifacts allows user to search/filter any API within SAP S/4HANA Cloud package. For example, to search for all the SOAP APIs for your integrations type in SOAP in the Filter Artifacts text field.

 

  • In order to search for specific API like Read Planned Orders, type in Read Planned Orders in the Filter Artifacts text field.  Click on the Read Planned Orders API from the filtered response to view the API Details.

 

  • In the OVERVIEW tab, API business documentation link, Best Practices explorer link and API’s sandbox, production endpoints details are provided.

 

 

  • Before proceeding further, we can log on to the SAP API Business hub, so that we can test these APIs live from the API Sandbox.

 

  • To view Business use case of the API click on the link “Scope Items – Material Requirements Planning (J44)”. Each of the S/4 HANA Cloud APIs is linked to Best Practices Explorer via the Scope Items which provides more business contextual information about the APIs.

 

 

  • This launches the Best Practices Explorer which explains the scenario in which the API can be used. Click on the Test Script to view more details about the required configurations, role assignments. Click on the Process Flow to view the process flow in the Graphical manner where this API can be used.

 

 

 

  • API Details like input parameters that can be passed, response that can be expected, example data set are documented in the RESOURCE tab. To view all this information, navigate to the RESOURCE tab.

  • SAP API Business Hub uses Open API Specification (a.k.a Swagger) viewer which enables Application developer to view API details in a developer friendly format. To view the details of the Planned Order entity and all the association operations, click on /A_PlannedOrder.

 

  • The Model view shows the details information about the Response field like property names, property data types, Property descriptions.

 

  • By scrolling down a little, you can see all the input parameters that can be optionally passed while invoking the API. For SAP S/4HANA Cloud API, these input parameters are $top, $skip, $select, $filter, $count in case of GET or Read operations which are the standard OData system query parameters. For example, to view only 2 planned orders set the value of $top to 2. $top & $skip is very useful while building responsive user interface with client side pagination.
  • For SAP S/4HANA Cloud APIs API Sandbox is available which allows the Application developer to test these APIs by just clicking on the Try it Out .

 

 

Testing from Postman and other API test tools

  • Postman is one of the API test tool which is used by the application developers. The S/4HANA Cloud APIs via API Sandbox can be tested from Postman or other such API test.
  • Copy the request URL from the try out and this URL can be used for testing SAP S/4HANA Cloud API Sandbox endpoint from Postman.

 

  • All the APIs from SAP API Business Hub API Sandbox are protected using API Key. This API Key would have to passed while invoking the SAP S/4HANA Cloud APIs via API Sandbox in Postman. The same API Key can be used for testing any of the API Sandbox APIs.
  • To get your own API Key click on the Get API Key in SAP API Business Hub.

 

  • Click on the Copy API Key to use it from the API Sandbox. Take some time to read through Disclaimer about the API key usage (*Disclaimer: The SAP API Business Hub provides an API Sandbox to try out APIs. The API Sandbox is intended solely for evaluation purposes and should not be relied on for any productive use. Please refer to official SAP documentation and developer websites for package and API information for SAP packages. SAP does not represent or warrant that the information provided on this website is current, complete or error-free, or that this website will continue to be made available.)

 

  • The copied API key would have to be passed in the header named apikey. For this navigate to the Headers tab in PostMan. In the key column type in apikey and then paste in your API Sandbox API key into the value column.

 

  • Click on the Send button to view the response from SAP S/4HANA Cloud API Sandbox.

 

  • SAP S/4HANA Cloud OData APIs supports response in both XML and JSON format. In order to view the response in the JSON format, set Accept header to application/json and then click on the Send button.

 

 

Generate Code for Interacting with SAP S/4HANA Cloud APIs

 

  • Generate Code functionality allows application developer to get sample code snippet in a programming language of their choice which enables them to interact with API in their application code project. For this, Generate Code option has been has been provided to each of the API entity/resource operation.

 

  • Click on the Copy to Clipboard to copy and use this generated boiler plate code in your code project.

 

Now that the right SAP S/4HANA Cloud API has been Discovered and Explored in SAP API Business Hub,  we can consume this API in a digital application.  The consumption of the Read Planned Order API to Fiori application using SAP Web IDE has been covered in the Part 2 of this blog series.

Assigned Tags

      9 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Sandip S Mundada
      Sandip S Mundada

      Hi Divya,

      Thanks for sharing such detailed explanation on SAP APIs and it's use in Fiori apps development.

      I am creating knowledge sharing document in my organization for training purpose and want to use content from your blog for SAP API management. Request you to provide permission for it's use.

      Thanks Sandip

      Author's profile photo Elijah Martinez
      Elijah Martinez

      Hi Sandip,

      Are you still looking to build training material from these blog series? Wanted to follow up on this, in case you were, as I believe your request was not seen yet.

      Regards,
      Elijah 

      Author's profile photo Sandip S Mundada
      Sandip S Mundada

      Hi Elijah,

       

      Yes, i am still in work in progress on build training material from these blog series. Please help me get approval from Blog owner or other SAP approval you can get.

       

      Thanks

      Sandip

      Author's profile photo Nagesh Yellapu
      Nagesh Yellapu

      Hi Divya,

       

      Very nice blog, are these APIs also available on the S4/HANA on premise system? or are these only available only in cloud version?

      Thank you.

      Author's profile photo Divya Mary
      Divya Mary
      Blog Post Author

      Hi Nagesh,

       

      Thanks for the feedback. APIs available in SAP API Business Hub are from SAP S/4HANA Cloud.

      Since SAP’s strategy is “Cloud First” and the release cycle for cloud is quarterly, the intention is to provide all new developed interfaces based on web based technologies in SAP S/4HANA Cloud and these APIs will be available within upcoming SAP S/4HANA On-Premise releases as well.

      For latest updates also reach out to SAP S/4HANA team.

      Thanks and Best Regards,

      Divya

      Author's profile photo Jaideep Adhvaryu
      Jaideep Adhvaryu

      Hi Divya,

      Came across this amazing & very informative blog series on OData in S/4Hana Cloud.

      I am hoping to get guidance on parallel execution of Odata services in S/4Hana Cloud. The data volume in some of our tables is large. So we want to explore calling an Odata service multiple times in parallel along with $top & $skip parameters.

      Will this work?

      Your feedback would be appreciated.

      Thanks!

      Jaideep

      Author's profile photo thiyagarajan s
      thiyagarajan s

      Hi Divya,

      Nice Blog.Can you please clarify me the following:

      If I introduce any structural change(some addition of new fields) to the Business Context and the OData Service that is tagged to the Business context will dynamically reflect the updated structure through API Business Hub or Should i need to get to make use of "Generate Code" option to append the new structure to the existing API structure and deploy it on SAP Cloud Platform to consume the API.

       

      With Regards,

      Thiyagarajan S

      Author's profile photo Jaideep Adhvaryu
      Jaideep Adhvaryu

      Hi Divya,

       

      Came across this amazing & very informative blog series on OData in S/4Hana Cloud.

       

      I am hoping to get guidance on parallel execution of Odata services in S/4Hana Cloud. The data volume in some of our tables is large. So we want to explore calling an Odata service multiple times in parallel along with $top & $skip parameters.

      Will this work?

      Your feedback would be appreciated.

      Thanks!

      Author's profile photo Krishna Madakasira
      Krishna Madakasira

      Thank you for this wonderful article. I tried to follow the steps outlined. The content is not in sync with the latest API hub web page. I see tryout option disabled although I have logged in with my S-ID. There no link to the sand box URL anywhere. I am trying to call OData API for BOM explosion.

      Any help will be greatly appreciated.

      Thank you.