Technology Blogs by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
cancel
Showing results for 
Search instead for 
Did you mean: 
vishal_kumar9
Explorer

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

 
10 Comments
Jelena
Active Contributor
0 Kudos

"using an API over IDOCs or BAPIs". OK, let's leave IDocs (correct spelling) aside for a second, although I've already shared my opinion about "API vs EDI" here.

I can create an ABAP report or a global class and call a BAPI there. How would an API, such as the one from your example, replace this, exactly? There isn't a way to access it that would work as simple as CALL FUNCTION. What is there to debate?

P.S. There are 61 OData V2 APIs available at the moment, the "200 odd" number you're referring to is the total of all APIs (V2, V4, REST, etc.).
P.P.S. I'm not quite sure if the process you're describing is specific to V2 (vs V4) APIs. I've never used V4 ones but just thinking logically, the OData standard version should have nothing to do with how the service is activated.

vishal_kumar9
Explorer
0 Kudos
Hi Jelena

Your Bog is indeed informative.

I have couple of questions to keep this debate alive 🙂

  1. I could use the BAPI in the ODATA service as well ( In the DPC extension class )

  2. With the APIs, I could share the metadata information so that it could be easily consumed by Applications across platforms without knowing about the backend SAP programming.


However, I do agree that APIs are not the replacement of BAPIs at least in the current scenario. Both have some advantages over the other. and thank you for bringing one of the advantages of using a BAPI.

 

Regards

Vishal Kumar
vishal_kumar9
Explorer
0 Kudos
Hi Jelena

I could not find where it shows the cumulative no of OData V2 APIs. I did some manual work to find there are 200-odd OData V2 APIs. However, if you could share your source I would be happy to update the correct information.

Second point, Yes the process of Activation of OData V4 APIs would remain more of less the same. However, in this blog for description and demonstration  I have referred to OData V2 only.

Regards

Vishal Kumar

 
Jelena
Active Contributor
Hi! The source was in my post, the text was a link. I just went to API Hub and clicked on the tabs there. It shows total number of records.

All: https://api.sap.com/content-type/API/apis/all

OData V2: https://api.sap.com/content-type/API/apis/ODATA

Jelena
Active Contributor

API and BAPI are used in completely different scenarios.

If someone can use an API (e.g. you have a Fiori app or some other web application and API does exactly what you need), then they'd be stupid not to. "What about BAPI?" shouldn't even be part of the thought process there.

But we still have to use BAPIs in many cases. And it's not because there is an "advantage" of using BAPIs, it's because API simply does not exist or it doesn't do what we need. Or we are not working with a web app in the first place (e.g. there are still programs written that need to work in a background job).

That's why "API vs BAPI" doesn't make sense because this is just not the type of choice we make.

amit777
Participant
0 Kudos
Thanks for the blog vishal.kumar9

I want to know how to use(activate and expose for CPI to consume) standard ODATA API like API_PRODUCT_SRV which is present in SAP API hub in S/4HANA.

I am trying to perform the steps you have mentioned in the blog using demo Gateway(ES5) by SAP and could not proceed further from step2.

Activate ODATA V2 API on S/4 HANA:
Step2 : Go to Gateway Service Builder ( Transaction : SEGW ). Open the Project providing the API Name ( API_BILLING_DOCUMENT )

Any idea why I am not able to see any standard API when I search in SEGW?

 

Thanks.
amit777
Participant
0 Kudos
Hi All, to update my question. I was able to perform activation of standard API on Gateway server provided by my client but this is not allowed as of now in Demo server provided by SAP.Thanks
vishal_kumar9
Explorer
0 Kudos
Hi Dilip

Yes, on the Demo Gateway Server, you are not allowed to create a new Project or activate the API.

But as you mentioned you were able to activate the API in the test server provided by your client, I hope this blog was helpful.

 

Regards

Vishal Kumar

 
0 Kudos
Hi Vishal,

Above given was a very crisp to the point explanation. Thanks for that. Will you be able to provide the same for SOAP APIs.

 
vishal_kumar9
Explorer
0 Kudos
Hi arpitadas

Thank you for your feedback!

I will definitely try to cover the SOAP APIs in my next blog.

 

Regards

Vishal Kumar
Labels in this area