Activate standard ODATA V2 API on S/4HANA – Consume & Test using Gateway Client


Introduction:

SAP has provided an extensive set of APIs to integrate and extend its products. APIs would be the way going forward, both in cloud and on-premise environment.

As a Developer, we should get familiar with the APIs and start using them for Integration or side-by-side extensions.

We can search for all the standard APIs on SAP API Business Hub. SAP API Business Hub is a web application hosted by SAP. It is a central catalog to find the API you want to use.

URL: SAP API Business Hub

To know facts and overview about SAP API Business hub go through the below blog.

SAP API Business Hub Overview and FAQ | SAP Blogs

So, Lets get started !! 🙂

Find an ODATA V2 API on S/4 HANA: 

Firstly, We need to search for a suitable API as per the Business need / Integration scenario. Below are the steps to search for a relevant API from the central catalog.

Step 1: Navigate to the SAP API Business Hub web application ( URL : SAP API Business Hub ).Explore the resources for S/4 HANA and then navigate to APIs => ODATA V2.

Note: For this Blog, we will keep our discussion limited to APIs of type ODATA V2.

Types of APIs:

    • ODATA ( ODATA V2 & ODATA V4 )
    • REST
    • SOAP

For more detailed information about types of APIs and APIs per type & Products, refer to below blog.

APIs – Types [ ODATA | REST | SOAP ] – Overview | SAP Blogs

It will show the list of APIs with ODATA V2 for S/4 HANA.

ODATA V2 APIs for S/4 HANA

Step 2: Search for the relevant API as per the Business Requirement using the Find Button ( Eg: Billing Document )

In the API Reference tab, we can see all the different Entity Set & various HTTP method which can be executed on the corresponding entity set.

In the Business Document, we get all the relevant information about the API.

Using Try Out option we can try the API in the SAP sandbox system.*

From the API specification, we can download the JSON or XML schema. ( Metadata Information )

Activate ODATA V2 API on S/4 HANA:

After, finding a relevant API, It should be activated on the S4 HANA system. Once the API is activated it can be consumed by other Applications or System.

Step 1: Get the Technical Name from the Business Document Tab

Technical name: API_BILLING_DOCUMENT_SRV

Step 2: Go to Gateway Service Builder ( Transaction : SEGW ). Open the Project providing the API Name ( API_BILLING_DOCUMENT )

           

Step 3: Register & Maintain the Gateway Service.

After Registering the Service, the API is ready to be consumed by External Applications.

Step 4: The API can be tested in Gateway Client ( Transaction : /IWFND/GW_CLIENT ) or POSTMAN tool.

JSON%20Response

JSON Response

The sample JSON response contains all the Billing Document information from the SAP S4 HANA tables. This JSON data can be consumed by UI application.

Summary:

Using the standard APIs available on the SAP API Business Hub, Developers can access the SAP service for Integrating with other Applications or Extending Solutions.

Currently, 200-odd ODATA V2 APIs are available and this list is continuously updated & upgraded. So next time when you login to SAP API business Hub this number might have changed.

These APIs can also be extended to accommodate custom Business Process or Information. The Extension of APIs would be covered in the next Blog.

You can comment your views on using an API over IDOCs or BAPIs .

Happy Learning ….Together !! 🙂

Kind Regards,
Vishal Kumar