S/4HANA Cloud Sandbox is now available in SAP API Business Hub
Since the introduction of SAP S/4HANA Cloud, API Business Hub acted as the central catalog where our partners and developers can explore the S/4HANA Cloud APIs. Those APIs enable you to integrate your SAP S/4HANA Cloud solution with other SAP products (Cloud or On-premise) and 3rd party products.
We’ve just introduced a S/4HANA Cloud public sandbox system to ease the use of APIs by our partners and developers for testing purposes. The sandbox system can be used for testing APIs with a read-only access. In order to test write operations, the tests should be performed against your SAP S/4HANA Cloud system. This Blog will explain how the new sandbox system might be helpful for you.
Exploring and testing API operations with ‘Try-it-out’
You are now able to explore the different operations offered with S/4HANA Cloud OData services and see how would the responses look like. This would help you in identifying if an API is suitable for your integration needs or not.
You need to be logged in to SAP API Business Hub in order to use the ‘Try-it-out’ feature. All the possible OData operations which you can test are available in the resources tab of the service. Taking as an example the OData service ‘Read Sales Contract’. If you go to the resources tab you can see the possible operations for each collection. For the ‘Sales Contract Item’ collection, this is visible below in screenshot 1.
screenshot 1: Entitysets and opertions for the ‘Read Sales Contract’ API
By expanding one of the operations, you can see more details about it. You can then click on the ‘Try-it-out’ button. API Hub then triggers a request to the sandbox system and the response received is displayed on the API Hub UI. In case you need to add any parameters to the request, this is also possible via the UI.
screenshot 2: Response code and body after triggering the request via the ‘Try it out!’ button
If you need to use the SAP API Business Hub to test SAP S/4HANA Cloud APIs against your own system, there is a new feature which enables you to create and configure an ‘API Endpoint’. You can use this feature to test write operations for an API. For more information on configuring API endpoints please refer to this guide.
screenshot 3: Configuring you own API endpoint
Building Fiori applications on ‘SAP Web IDE’
You can build applications that consume services exposed on the S/4HANA Cloud sandbox system making use of the SAP API Business Hub integration with the SAP Web IDE Full-Stack version. This feature can be used to demonstrate how SAP Cloud Platform can be used to enhance and extend your SAP S/4HANA Cloud solution.
To consume the APIs in SAP Web IDE, you need to select ‘New Project from Template’ and in the data connection section of the wizard you can select the source as ‘SAP API Business Hub’, then select the ‘SAP S/4HANA Cloud’ package from the drop down menu to filter the services. You can also get more details and further documentation about the API in the ‘API Details’ section.
screenshot 4: Consuming S/4HANA Cloud APIs on SAP Web IDE Full-Stack version
Testing APIs from REST clients and custom applications
You can also make use of the APIs exposed on the sandbox system in any of your preferred REST clients or custom applications (not build on SAP Web IDE). In order to be able to consume the sandbox APIs, you need to add an ‘apikey’ attribute in the request header. The API Key can be obtained from the SAP API Business Hub as shown below (You need to be logged in).
screenshot 5: API Key for the SAP S/4HANA Cloud sandbox
You can also use the ‘Generate Code’ feature which provides you prepared code snippets in different programming languages which you can directly copy-paste into your application.
screenshot 6: Generating code snippets for custom API usage.
- The SAP S/4HANA Cloud sandbox system for API Business Hub can only be used for testing purposes and not for productive application development or use cases.
- The SAP S/4HANA Cloud sandbox system allows only read operations. Write operations are not allowed against the sandbox system.
- The SAP API Business Hub integration with SAP Web IDE is only available for the ‘SAP Web IDE Full-Stack’ version.
Hi Hassan El Salamouni
I am very new to this. Could you please confirm whether my below assumption is correct?
The API's are meant for integrating S/4HANA Cloud solution with other SAP products (Cloud or On-premise) and 3rd party products. For S/4 HANA on-premise version, we don't have such API's, and the external systems have to use other methods like OData service to communicate with them.
Actually the S/4HANA Cloud APIs mentioned in the blog are mostly OData services. In S/4HANA on-premise the same OData services exist to integrate your solution with other SAP or 3rd party products. However, it might be the case for some APIs that not all operations/methods are offered for the API.
Added to that, In S/4HANA on-premise the way you expose the services for consumption is different. You can directly expose the APIs from SAP Gateway without creating communication arrangements as in S/4HANA Cloud.
Hope this is helpful.
We currently have many BAPI interfaces on ECC6 to create and maintain eg Sales Orders from external systems. The way it works is that a custom BAPI is called from the external system which formats the required data to feed and call the standard BAPI.
If we move to S/4 Hana (on-prem or cloud) what untimely gets executed in the backed SAP system? is it also a BAPI or something else ?
Hello Hassan El Salamouni
Currently, We expose a service in PO that connect with a BAPI ( ECC on-prem) to create service notifications.
That functionality should be migrated to CPI and S4H/Cloud, but the API doesn't exist.
Can you recommend an alternative to cover custom scenarios like this?
How can I get access to a S/4HANA cloud sandbox, can anyone help me?
Please not trial since this has very limited scenarios