API Consumption – S/4 HANA Cloud,Public Edition and S/4 HANA Cloud,Private Edition

Estimated read time 14 min read

With the evolving SAP landscape and customers moving to S/4 HANA Cloud , our prime focus as a consultant is to follow a clean core approach.

SAP Business Accelerator Hub(https://api.sap.com/) is one such platform which helps us in discovering standard APIs,Events, Extensibility options

which we can consume in our S/4 HANA landscape to achieve end-to-end business functionality. This blog focusses mainly on the API consumption from

SAP Business Accelerator HUB and how it differs between the two of the S/4 HANA Cloud offerings – S/4 HANA Cloud,Public Edition and S/4 HANA Cloud,Private Edition.

We will first go through some of the basic differences and then focus on technically how we can use or consume these APIs in each of the environments.

 

S/4 HANA Cloud Public Edition

S/4 HANA Cloud Private Edition

Where to find?

 

Ready to use APIs available in Business Accelerator Hub(https://api.sap.com/) to be explored under the Tile –
 

 

Ready to use APIs available in Business Accelerator Hub(https://api.sap.com/) to be explored under the Tile –

 

Activation

 

Communication management based API Activation. APIs are part of a standard communication scenario.

 

Communication scenario can be found from SAP Business Accelerator HUB as below –

 

 

SICF based API activation(OData V2)

For OData V4 no specific activation is needed but the Service Group needs to be published. Not associated to any communication scenario.

 

 

Sandbox availability

TryOut” option available in SAP Business Accelerator HUB for OData APIs to execute the CRUD methods with Sandbox data. Also you can deploy your own system to do tryout with your actual data of your S/4 HANA Cloud,Public Edition system.

 

 

 

No Tryout option available with any Sandbox. Also here the S/4 HANA system is in a private network and often there will be a Cloud Connector in between so TryOut options have been restricted for APIs for Private Edition

 

 

 

 

Consumption

API is consumed through a communication arrangement which is based on a standard communication scenario. Standard Fiori Application –   Communication Arrangements to be used for consumption.

For OData V2 API is activated through transaction code – /n/IWFND/MAINT_SERVICE

For OData V4 API no separates activation is required but service group needs to be published through transaction code – /n/IWFND/V4_ADMIN

Practice Guide

We will be using OData V2 – API – API_PRODUCT_SRV as an example to demonstrate the activation of the API in S/4 HANA Public Cloud and S/4 HANA Private Cloud.

API Link for Public Edition – https://api.sap.com/api/API_PRODUCT_SRV/overview

API Link for Private Edition – https://api.sap.com/api/OP_API_PRODUCT_SRV_0001/overview

 

Scenario 1# Activating API in Public Cloud –

Navigate to the link https://api.sap.com/api/CE_PRODUCT_0002/overview  for the API or you can search the API as below.

In https://api.sap.com/ go to the tile SAP S/4 HANA Cloud Public Edition

 

Under APIs go to ODATA V2 and search with “Product” and open the one Product Master(A2X) which say ODATA V2 API and is “Active”  for usage.

 

From SAP Business Accelerator HUB you will get the SAP standard communication scenario for the API –

 

Here we will be creating arrangement for communication scenario – SAP_COM_009

Next create a communication user from the Fiori application “Create Communication User”.

 

Give a Username and you can use the “Propose Password” option or you can add your own password.

 

Next step is to create a communication system from the Fiori application “Communication Systems

 

Click on “New” and provide a System ID and System Name –

 

 

Go to tab “Users for Inbound Communication” and assign the user you just created in the previous step using “Create Communication Users”.

 

 

For the ease of use you can check the checkbox “Inbound Only” which means you are not expecting any outbound communication (S/4HANA -> External) through this communication system and so you will not be asked to enter any user for Outbound communication user for this communication system.

Save the communication system.

Next step is to create the communication arrangement. Go to application “Communication Arrangements

 

Click on “New

In the following tab enter “SAP_COM_0009” as the standard communication scenario for API_PRODUCT_SRV.

 

Select the ‘Communication System'(from value help) which we have just created in the previous step. The assigned Communication User will now automatically appear in User Name field.

 

Click “Save” and it will activate your communication arrangement.

You can get your actual service URL for all Inbound Services associated, under the tab “Inbound Services” under the column “Service URL/Service Interface”.

Similarly all the Outbound services associated with this communication Scenario “SAP_COM_0009” will show under the tab “Outbound Services”.Outbound services are generally either SOAP Outbound services or IDOCs.

 

 

All the services that belong to the communication scenario “SAP_COM_0009” will be listed here under the tab “Inbound Service”.

Get the URL where the Service says “Product Master(A2X)” / OData V2”

 

The API link looks like this – https://<host>/sap/opu/odata/sap/API_PRODUCT_SRV

So this makes your API ready for consumption from the external system.

Get the service URL and test it from POSTMAN using the communication user that you created in the first step. In POSTMAN you can use it for Basic Authentication under Authorization.

You can call this URL from SAP Integration Suite using a OData V2 Adapter with basic authentication with the user you created in “Communication User” application.

NoteFor Public cloud the way of activating a OData V2 service and OData V4 service are same unlike Private Cloud where there is a difference.

So for OData V4 the API will be also activated by a communication arrangement only as shown above and the URL will look like this – https://<host>/sap/opu/odata4/sap/api_product/srvd_a2x/sap/product/0002/

Link to API Hub for the OData V4 API of Product Master – https://api.sap.com/api/CE_PRODUCT_0002/overview

 

Scenario 2# Activating API in Private Cloud –

First step same as Public cloud to find the API from https://api.sap.com/ .

Navigate to the link https://api.sap.com/api/OP_API_PRODUCT_SRV_0001/overview for the API or you can search the API as below.

In https://api.sap.com/ go to the tile SAP S/4 HANA Cloud Private Edition

 

Under APIs go to ODATA V2 and search with “Product master” and open the one Product Master(A2X) which say ODATA V2 API.

 

 

Next Run Transaction Code – /n/IWFND/MAINT_SERVICE

Click on “Add Service

Provide System Alias = “LOCAL” and under Technical Service name – “API_PRODUCT_SRV” and click on “Get Services

 

Then select the service you want to activate and click on “Add Selected Services

You can provide the package where you want to assign the service.

 

If you want to use OAuth authentication you have to check the checkbox “Enable OAuth for Service

The next step is to activate the service as shown below. However it is recommended to go and activate the service from SICF transaction code.

 

Your OData V2 Activation is complete and you can test it from the Gateway. You can call this service now from SAP Integration Suite with a technical user who has the necessary roles.

 

 

Bonus Scenario # Now we will see how we can activate a similar OData V4 service of Product Master.

To find the OData V4 API go to https://api.sap.com/ and go to the node – “SAP S/4 HANA Cloud Private Edition

 

Under APIs->ODATA V4 -> Search Product

 

Select the “Odata V4” one which is “Active” and not “DEPRECATED

 

Under API Resources -> Attributes you will find the Service Group Name which you need to publish.

 

Now Go to Transaction – /n/IWFND/V4_ADMIN and click on “Publish Service Groups

 

Next enter the Service Group Name you got from Business accelerator Hub and click on “Get Service Groups

 

 

Now your OData V4 API will be ready for consumption from Integration Suite.

 

 

 

​ With the evolving SAP landscape and customers moving to S/4 HANA Cloud , our prime focus as a consultant is to follow a clean core approach.SAP Business Accelerator Hub(https://api.sap.com/) is one such platform which helps us in discovering standard APIs,Events, Extensibility optionswhich we can consume in our S/4 HANA landscape to achieve end-to-end business functionality. This blog focusses mainly on the API consumption fromSAP Business Accelerator HUB and how it differs between the two of the S/4 HANA Cloud offerings – S/4 HANA Cloud,Public Edition and S/4 HANA Cloud,Private Edition.We will first go through some of the basic differences and then focus on technically how we can use or consume these APIs in each of the environments. S/4 HANA Cloud Public EditionS/4 HANA Cloud Private EditionWhere to find? Ready to use APIs available in Business Accelerator Hub(https://api.sap.com/) to be explored under the Tile –  Ready to use APIs available in Business Accelerator Hub(https://api.sap.com/) to be explored under the Tile – Activation Communication management based API Activation. APIs are part of a standard communication scenario. Communication scenario can be found from SAP Business Accelerator HUB as below –  SICF based API activation(OData V2)For OData V4 no specific activation is needed but the Service Group needs to be published. Not associated to any communication scenario.  Sandbox availability“TryOut” option available in SAP Business Accelerator HUB for OData APIs to execute the CRUD methods with Sandbox data. Also you can deploy your own system to do tryout with your actual data of your S/4 HANA Cloud,Public Edition system.   No Tryout option available with any Sandbox. Also here the S/4 HANA system is in a private network and often there will be a Cloud Connector in between so TryOut options have been restricted for APIs for Private Edition    ConsumptionAPI is consumed through a communication arrangement which is based on a standard communication scenario. Standard Fiori Application –   Communication Arrangements to be used for consumption.For OData V2 API is activated through transaction code – /n/IWFND/MAINT_SERVICEFor OData V4 API no separates activation is required but service group needs to be published through transaction code – /n/IWFND/V4_ADMINPractice GuideWe will be using OData V2 – API – API_PRODUCT_SRV as an example to demonstrate the activation of the API in S/4 HANA Public Cloud and S/4 HANA Private Cloud.API Link for Public Edition – https://api.sap.com/api/API_PRODUCT_SRV/overviewAPI Link for Private Edition – https://api.sap.com/api/OP_API_PRODUCT_SRV_0001/overview Scenario 1# Activating API in Public Cloud –Navigate to the link https://api.sap.com/api/CE_PRODUCT_0002/overview  for the API or you can search the API as below.In https://api.sap.com/ go to the tile SAP S/4 HANA Cloud Public Edition Under APIs go to ODATA V2 and search with “Product” and open the one Product Master(A2X) which say ODATA V2 API and is “Active”  for usage. From SAP Business Accelerator HUB you will get the SAP standard communication scenario for the API – Here we will be creating arrangement for communication scenario – SAP_COM_009Next create a communication user from the Fiori application “Create Communication User”. Give a Username and you can use the “Propose Password” option or you can add your own password. Next step is to create a communication system from the Fiori application “Communication Systems” Click on “New” and provide a System ID and System Name –  Go to tab “Users for Inbound Communication” and assign the user you just created in the previous step using “Create Communication Users”.  For the ease of use you can check the checkbox “Inbound Only” which means you are not expecting any outbound communication (S/4HANA -> External) through this communication system and so you will not be asked to enter any user for Outbound communication user for this communication system.Save the communication system.Next step is to create the communication arrangement. Go to application “Communication Arrangements” Click on “New”In the following tab enter “SAP_COM_0009” as the standard communication scenario for API_PRODUCT_SRV. Select the ‘Communication System'(from value help) which we have just created in the previous step. The assigned Communication User will now automatically appear in User Name field. Click “Save” and it will activate your communication arrangement.You can get your actual service URL for all Inbound Services associated, under the tab “Inbound Services” under the column “Service URL/Service Interface”.Similarly all the Outbound services associated with this communication Scenario “SAP_COM_0009” will show under the tab “Outbound Services”.Outbound services are generally either SOAP Outbound services or IDOCs.  All the services that belong to the communication scenario “SAP_COM_0009” will be listed here under the tab “Inbound Service”.Get the URL where the Service says “Product Master(A2X)” / OData V2” The API link looks like this – https://<host>/sap/opu/odata/sap/API_PRODUCT_SRVSo this makes your API ready for consumption from the external system.Get the service URL and test it from POSTMAN using the communication user that you created in the first step. In POSTMAN you can use it for Basic Authentication under Authorization.You can call this URL from SAP Integration Suite using a OData V2 Adapter with basic authentication with the user you created in “Communication User” application.Note – For Public cloud the way of activating a OData V2 service and OData V4 service are same unlike Private Cloud where there is a difference.So for OData V4 the API will be also activated by a communication arrangement only as shown above and the URL will look like this – https://<host>/sap/opu/odata4/sap/api_product/srvd_a2x/sap/product/0002/Link to API Hub for the OData V4 API of Product Master – https://api.sap.com/api/CE_PRODUCT_0002/overview Scenario 2# Activating API in Private Cloud –First step same as Public cloud to find the API from https://api.sap.com/ .Navigate to the link https://api.sap.com/api/OP_API_PRODUCT_SRV_0001/overview for the API or you can search the API as below.In https://api.sap.com/ go to the tile SAP S/4 HANA Cloud Private Edition Under APIs go to ODATA V2 and search with “Product master” and open the one Product Master(A2X) which say ODATA V2 API.  Next Run Transaction Code – /n/IWFND/MAINT_SERVICEClick on “Add Service”Provide System Alias = “LOCAL” and under Technical Service name – “API_PRODUCT_SRV” and click on “Get Services” Then select the service you want to activate and click on “Add Selected Services”You can provide the package where you want to assign the service. If you want to use OAuth authentication you have to check the checkbox “Enable OAuth for Service”The next step is to activate the service as shown below. However it is recommended to go and activate the service from SICF transaction code. Your OData V2 Activation is complete and you can test it from the Gateway. You can call this service now from SAP Integration Suite with a technical user who has the necessary roles.  Bonus Scenario # Now we will see how we can activate a similar OData V4 service of Product Master.To find the OData V4 API go to https://api.sap.com/ and go to the node – “SAP S/4 HANA Cloud Private Edition” Under APIs->ODATA V4 -> Search Product Select the “Odata V4” one which is “Active” and not “DEPRECATED” Under API Resources -> Attributes you will find the Service Group Name which you need to publish. Now Go to Transaction – /n/IWFND/V4_ADMIN and click on “Publish Service Groups” Next enter the Service Group Name you got from Business accelerator Hub and click on “Get Service Groups”  Now your OData V4 API will be ready for consumption from Integration Suite.     Read More Technology Blog Posts by Members articles 

#SAP

#SAPTechnologyblog

You May Also Like

More From Author