Technical Articles
How to discover SAP API’s in SAP S/4HANA Cloud, OP/Private Cloud Edition
Scenario:
You are looking to build a business process integration between SAP S/4HANA and SAP S/4HANA Cloud, extended edition or SAP Business Suite(also referred to as SAP ERP6 or SAP ECC6) or a non-SAP system and have been asked to look at the SAP API Business Hub to find a suitable whitelisted OData/REST or SOAP/WebService API. How do you find this API in SAP S/4HANA Cloud, extended edition via SAP Transaction Codes(TCodes)?
*Important Note: This blog helps you discover the whitelisted API’s (originally provided for SAP S/4HANA Cloud, essentials) for SAP S/4HANA Cloud, extended edition; however, while an API can be found on SAP API Business Hub and in SAP S/4HANA Cloud, extended edition, you still need to check if the structure and functional coverage of the API will cover your use case/business requirements in SAP S/4HANA Cloud, extended edition.
Reference:
For the latest SAP S/4HANA Cloud, extended edition extensibility guide, please refer to SAP OSS Note: 2920697-Extensibility Guide for SAP S/4HANA Cloud, extended edition
Summary & Prerequisites:
- Know your business process integration requirements and the business object, for example, Sales Order, Product Group or Purchase Order, Journal Entry etc.
- Go to SAP API Business Hub (https://api.sap.com) and login with your S# ID
- Log into the SAP S/4HANA Cloud, extended edition system (Development system) via SAP GUI – NOTE: I am using a Sandbox SAP S/4HANA, extended edition system (recent release version 1909 FPS01) for my screenshots and documentation steps here
- Ensure you read the following OSS Note and SAP Help link for appropriate SAP authorizations:
- For SAP Gateway – https://help.sap.com/erp_hcm_ias2_2015_01/helpdata/en/24/f82651c294256ee10000000a445394/frameset.htm
- For SAP transaction code SOAMANAGER – OSS Note: 1725979 – Security standard SEC-250 and Web service roles
NOTE: All screen shots you see below are created while on a sandbox system of SAP S/4HANA Cloud, extended edition using release 1909 FPS01. These screen shots are meant as examples and so please create your scenario based on your respective system and naming conventions.
Steps to discover OData/REST API in SAP S/4HANA Cloud, extended edition:
- On API Hub:
- Go to SAP API Business Hub and login with your S# ID
- Click on the tile ‘SAP S/4HANA Cloud’
-
- In the Search bar, type in your business object for example, Product Group and then click on the OData API you need for your integration scenario
-
- Once in the required OData API, click on Details tab and locate the technical name of the API as highlighted in the screenshot under the Specification/Attributes section, for example API_PRODUCTGROUP_SRV (Hint: the technical name of the API will be at the end of the Endpoint URL for Sandbox URL and Production URL)
-
- Note down the technical name (e.g. API_PRODUCTGROUP_SRV) of your API as we will now locate this in SAP S/4HANA and SAP S/4HANA Cloud, extended edition
- In SAP S/4HANA Cloud, extended edition:
- Log into your SAP S/4HANA Cloud, extended edition system (starting with Development or Sandbox instance)
- Via SAPGUI, go to transaction code /IWFND/MAINT_SERVICE
- Search for your API with the technical name we noted down from SAP API Business Hub steps above
- If you do not find your API in the Service Catalog frame, create it with a Z or Y name by clicking on ‘Add Service’ button as shown here
-
- Enter your API name ‘API_PRODCTGROUP_SRV’ from API Hub in Technical Service Name and enter ‘LOCAL’ for System Alias as seen below
-
- Click on ‘Get Services’
-
- Highlight the row of your required API service in the section Select Backend Services and click on ‘Add Selected Services’ button
-
- Ensure your Technical Service Name starts with Z or Y e.g. ZAPI_PRODUCTGROUP_SRV and for Package Assignment, click on Local Object (for this example) e.g. $TMP > click on green check mark i.e. Enter button
-
- Go back to the initial Service Catalog screen of TCode:/IWFND/MAINT_SERVICE & find your API service created in the step above
-
- Highlight the row by selecting you required API Service
-
- Highlight the ODATA row under ICF Nodes section/frame and then click on button “SAP Gateway Client” which will then launch in a separate window
-
- In the SAP Gateway Client window, you can test your API service for the different methods like GET, POST, PATCH, READ etc. if it supports CRUD operations
-
- We will test a simple GET method in this example by updating the end of the Request URI, ?format=xml to $metadata as such /sap/opu/odata/sap/API_PRODUCTGROUP_SRV/$metadata” > Click on ‘Execute’ button
-
- Above you will see the metadata information about this API and at this point you can further update your GET method for the required results your business process integration might require
- Troubleshooting an OData API Service in SAP S/4HANA Cloud, extended edition:
- Useful OSS Note: 2527329 – No System Alias found for Service ‘<service name>’ and user ‘<current user>’
- TCode SPRO > SAP NetWeaver > SAP Gateway > OData Channel > Configuration > Connection Settings > SAP Gateway to SAP System – for creating a LOCAL system alias if one doesn’t exist
-
- TCode SPRO > SAP NetWeaver > SAP Gateway > OData Channel > Configuration > Connection Settings > Activate or Deactivate SAP Gateway – activating SAP Gateway in case it is deactivated
Steps to discover SOAP/WebService API in SAP S/4HANA Cloud, extended edition:
- On SAP API Business Hub:
- Go to SAP API Business Hub and login with your S# ID
- Click on the tile ‘SAP S/4HANA Cloud’
- In the Search bar, type in your business object for e.g., Purchase Order(Inbound, Asynchronous) and then click on the SOAP API you are researching for your integration scenario
-
- Once in the required SOAP API, click on API References tab and locate the object name of the API. You can search this object name by Port Type name for e.g. PurchaseOrderRequest_In or by the Port binding location for e.g. mmpur_purchaseorderrequest_in
-
- Note down the object name (e.g. PurchaseOrderRequest_In or mmpur_purchaseorderrequest_in) of your API service as we will now locate this in SAP S/4HANA Cloud, extended edition
- In SAP S/4HANA Cloud, extended edition:
- Via SAPGUI, go to transaction code SOAMANAGER, which will launch a browser window
- Under Service Administration > Click on Web Service Configuration
-
- Enter the name of the object(for e.g. mmpur_purchaseorderrequest_in) in Object name location and click on Search
-
- Under Internal Name column, click on the link for your SOAP API service, for e.g. ‘mmpur_purchaseorderrequest_in’, and you will be brought to the Define Service and Bindings screen > Click on Create Service button
-
- Enter Service Name, description and binding name. In this example, I’ve used the Service Name for the Binding Name with the exception of using ‘_BND’ at the end of the name to distinguish between Service Name and New Binding Name > Click Next
-
- For this example, I have selected basic UID/Password authentication but for your productive usage, you must secure this channel and message authentication > click Next
- In this example, I am not using a load balancer to enter an alternate URL but if your productive system has such an LB in front of it, you can enter that alternate URL here > Click Next
- Accept default values here and click Finish
- Click on the icon “Open Service WSDL Generation” under the Actions column for the API Service “PURCHASEORDERREQUEST_IN”
-
- In this window you will find your SOAP endpoint URL towards the bottom and you can also explore the WSDL service here. For the SOAP endpoint URL see the line in the ‘WSDL URL for Service’ box
-
- Click on the icon ’Open WSDL Document for selected binding or service’ for launching the WSDL service file which will launch in a new browser window
That’s it for now! I hope this helps you with your integration and extensibility in SAP S/4HANA Cloud, extended edition.
Appreciate your feedback.
Awesome blog! Just the right amount of information presented in an easily understandable way. Thanks a lot, Fabian.
Thanks Fabian. Your blog is good and precise.
Awesome Blog !!! Nicely Articulated in easy and precise way for better understanding. Thanks a lot.
Nice Information
Where to write our code after finding API and how to link that code to fiori..
Hi Sandesh, from SAP's perspective, we'd recommend you use the SAP Business Technology Platform for your side-by-side extensions. It gives you the best support to create and run business apps which utilize mainly data from SAP applications. https://www.sap.com/products/business-technology-platform.html
Hello Fabian,
Good blog, but I have a problem. I use "soamanager" to maintain a soap API. There are several clients in our development system, so I maintain it in one of the clients used for configuration. I want to transfer it to other clients to avoid maintaining every client. How can I do this? Please give me some advice.
Thanks,
Lingling
Hi Fabian,
How can I get an user to access the API with external tool like postman?
Thanks,
Aaron