Testing SAP S4HANA Cloud API Services
Testing SAP S4HANA Cloud API Services
1 Document History. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
You can test the provided APIs in the SAP S/4HANA Cloud package with your own SAP S/4HANA Cloud
system. or You can also test with the SAP API Business Hub sandbox system provided to our customers and
partners.
You can easily test the APIs by using the Try Out feature on the API References tab of an API service. Testing
SAP S/4HANA Cloud APIs helps you find out more about how an API service is structured and whether it is
suitable for your business needs. You have the option of calling the API on your own SAP S/4HANA Cloud
system with your own test data. And you can retrace how requests need to be built and see what responses you
can expect. If you don't have access to your own SAP S/4HANA Cloud system, you can test the APIs with the
SAP API Business Hub sandbox system.
Note
These are the constraints when testing SAP S/4HANA Cloud APIs:
● Testing of SAP S/4HANA Cloud APIs that are available on the SAP API Business Hub (API Hub) can
only be provided for OData services.
● You can test only READ operations on the sandbox system of the SAP API Business Hub. However, SAP
S/4HANA Cloud API services support both READ and WRITE operations.
● In this guide, we describe the testing for inbound services as only these services can be used on an SAP
S/4HANA Cloud system. Outbound services are services provided by other systems or third party
software components outside of SAP S/4HANA Cloud.
The SAP API Business Hub lets you test the SAP S/4HANA Cloud APIs against a public sandbox system that is
dedicated to exploring SAP S/4HANA Cloud APIs.
Note
You need to be logged on to SAP API Business Hub to use the Try out feature. For more information, see
Trying Out APIs in the Sandbox Environment at https://help.sap.com/viewer/product/
SAP_API_BUSINESS_HUB/Cloud/en-US under End User Information Exploring the SAP API Business
Hub API Packages Trying Out APIs Trying Out APIs in a Sandbox Environment (https://
help.sap.com/viewer/84b35b9c39b247e3ba2a31f02beee46d/Cloud/en-US/
74fa07983b1c41ffba251e14e4c31a11.html).
To test an API service with the API Business Hub Sandbox, proceed as follows:
Example
We are showing the API environment with the example of the Business Events Subscription OData
service. If you go to the API References tab, the operations for each entity set are displayed.
Test with the SAP API Business Hub Sandbox [page 5]
Operations Available for Business Events Subscription
If you expand one of the operations, you'll get UI features that are comparable to the common features in
any REST client.
5. In the final step, just add the parameters that you need for the request (adding more parameters is
optional).
6. Choose Try out to run the test. The SAP API Business Hub triggers a request in the sandbox system. The
response is displayed on the API Hub UI.
SAP API Business Hub lets you test the APIs directly on your own SAP S/4HANA Cloud system. For more
information, see Trying Out APIs in the Productive Environment at https://help.sap.com/viewer/product/
SAP_API_BUSINESS_HUB/Cloud/en-US under End User Information Exploring the SAP API Business Hub
API Packages Trying Out APIs Trying Out APIs in a Productive Environment (https://help.sap.com/
viewer/84b35b9c39b247e3ba2a31f02beee46d/Cloud/en-US/f7796baaef6a48e9867298827f5028ff.html).
To get started, you need to set up communication management and provide an authentication option. To run
the test in your own system, you need to configure a new API environment.
We use sample data to demonstrate API testing. In this example, we're using the Business Event Subscription
OData service for demonstration purposes. For more information about this service, choose SAP S/4HANA
Cloud on the SAP API Business Hub under http://api.sap.com . On the APIs tab, choose the API service you
need. For API service documentation, see Business Documentation on the Details tab.
The Business Events Subscription API is part of the Business Event Handling (SAP_COM_0121) communication
scenario. To test this API in your own system, you need to create an SAP_COM_0121 communication
arrangement instance. When you create a communication arrangement instance in the SAP S/4HANA Cloud
and activate it by saving, the service environment will be provided under the Inbound Services section. It will
look like this:
https://<S4HANACLOUD-HOSTNAME>/sap/opu/odata/sap/CA_BEH_SUBSCRIPTION_SRV
Related Information
You need to set up communication management if you want to consume and test SAP S/4HANA Cloud OData
APIs and integrate your solution with other systems.
● Communication Users
● Communication Systems
● Communication Arrangements
You need to make these settings because the service environments that are used to call an API are maintained
in the Communication Arrangement setup. You can find these apps on SAP Fiori launchpad in your SAP
S/4HANA Cloud system. To define the settings, proceed as follows:
1. Assign your user to a business role containing the business catalog SAP_CORE_BC_COM for
Communication Management.
For more information, see Product Assistance of SAP S/4HANA Cloud under Extend and Integrate Your
SAP S/4HANA Cloud Integration Communication Management Maintain Communication Users
(https://help.sap.com/viewer/0f69f8fb28ac4bf48d2b57b9637e81fa/latest/en-US/
eef80dda3867461c92ac1273689ed36f.html).
2. Proceed with the steps for configuring the Communication Arrangements apps as described in Product
Assistance for SAP S/4HANA Cloud under Extend and Integrate Your SAP S/4HANA Cloud Integration
Communication Management Communication Arrangements (https://help.sap.com/viewer/
0f69f8fb28ac4bf48d2b57b9637e81fa/latest/en-US/fab3fd449cf74c6384622b98831e989e.html).
The API services you want to call need to be part of a communication arrangement that has been activated in
your SAP S/4HANA Cloud system. Check to see whether this activation has taken place.
For more information, see Product Assistance for SAP S/4HANA Cloud under Extend and Integrate Your SAP
S/4HANA Cloud Integration Communication Management (https://help.sap.com/viewer/
0f69f8fb28ac4bf48d2b57b9637e81fa/latest/en-US/2e84a10c430645a88bdbfaaa23ac9ff7.html).
To call the service on your own SAP S/4HANA Cloud back-end system, you need to provide the authentication
for the communication user you used to set up the communication arrangement (see Set Up Communication
Management [page 7]). When creating your arrangement, you have the option of choosing different
To test the API services in your own SAP S/4HANA Cloud system, you need to configure a new API
Environment. Proceed with these steps:
API Environment field on the API References tab of SAP API Business Hub
4. Choose Configure Environments to start creating your new API Environment configuration. A form for
entering the required system information is displayed.
5. Fill in the form as follows:
1. Enter a system alias in the Display Name for Environments field to identify the system for which you are
creating the environment.
2. Enter the host name of the system you are connecting to. You can get this from the API environment
that you can see in the communication arrangement you activated earlier.
3. Enter the port number for https communication (the default is 443).
4. Enter the Basic Auth Username and Password for the inbound communication user you used to
activate the communication arrangement.
Note
To test SAP S/4HANA Cloud APIs against your own system using the API Hub UI, you need to configure
SAP API Business Hub to connect to your back-end system. You do this by configuring a new API
environment for your APIs; see Configure a New API Environment [page 8].
4. Test whether you can reach your API environment from the API Hub UI. To do so, execute any of the
available GET operations. As a response, a message appears showing that the API was successfully
invoked in the target system.
Example of a success response for Try Out
Hyperlinks
Some links are classified by an icon and/or a mouseover text. These links provide additional information.
About the icons:
● Links with the icon : You are entering a Web site that is not hosted by SAP. By using such links, you agree (unless expressly stated otherwise in your
agreements with SAP) to this:
● The content of the linked-to site is not SAP documentation. You may not infer any product claims against SAP based on this information.
● SAP does not agree or disagree with the content on the linked-to site, nor does SAP warrant the availability and correctness. SAP shall not be liable for any
damages caused by the use of such content unless damages have been caused by SAP's gross negligence or willful misconduct.
● Links with the icon : You are leaving the documentation for that particular SAP product or service and are entering a SAP-hosted Web site. By using such
links, you agree that (unless expressly stated otherwise in your agreements with SAP) you may not infer any product claims against SAP based on this
information.
Example Code
Any software coding and/or code snippets are examples. They are not for productive use. The example code is only intended to better explain and visualize the syntax
and phrasing rules. SAP does not warrant the correctness and completeness of the example code. SAP shall not be liable for errors or damages caused by the use of
example code unless damages have been caused by SAP's gross negligence or willful misconduct.
Gender-Related Language
We try not to use gender-specific word forms and formulations. As appropriate for context and readability, SAP may use masculine word forms to refer to all genders.
SAP and other SAP products and services mentioned herein as well as
their respective logos are trademarks or registered trademarks of SAP
SE (or an SAP affiliate company) in Germany and other countries. All
other product and service names mentioned are the trademarks of their
respective companies.