In a basic Java program, read the Business Partner API service using SAP Cloud SDK.
For the complete execution of current exercise, you must execute the following exercises first:
- Create your Free Trial Account in SAP BTP
- Activating the APIs in SAP S/4HANA Cloud: this exercise activates the required API in the S/4HANA Cloud tenant.
For the full execution of this exercise, you need to have the following software installed on your laptop:
|Java Development Kit, Standard Edition||8|
|Cloud Foundry CLI||latest||application|
|IntelliJ IDEA Community Edition||latest||application|
|Visual Studio Code||latest||application|
|Cloudfoundry Manifest YML Support||latest||Visual Studio Code Extension|
|Debugger for Java||latest||Visual Studio Code Extension|
|Project Manager for Java||latest||Visual Studio Code Extension|
|Extension Pack for Java||latest||Visual Studio Code Extension|
|Test Runner for Java||latest||Visual Studio Code Extension|
|Language Support for Java(TM) by Red Hat||latest||Visual Studio Code Extension|
Some steps of this exercise depend on the https://api.sap.com website. As a consequence, they may not run properly if the website is not running 100% correctly. In this case, proceed with the exercise to reach the part that runs against the SAP S/4HANA Cloud instance.
Information for execution
After every step description, you can choose the [play] link to open a recorded simulation of the described actions.
The exercise comes with the following two archive files:
java-call-api-initial.zip[download] contains the Maven project in its initial status. This project has to be imported as a prerequisite for the execution of the exercise.
java-call-api-solution.zip[download] contains the Maven project in its final status after the correct execution of the exercise. This project can be used to clarify the correct solution, or to copy and paste parts of source code.
In the case you wish to run the solution application directly without going through the exercise steps, then complete the following actions (this is not a prerequisite to exercise execution):
- Extract the archive to a folder in your local system.
- Open the folder with your preferred Java IDE (such as Visual Studio Code). Check the status bar until the analysis of the project is complete.
- Edit the
- Replace ">>YOUR API KEY<<<" with your own API Key (for example
"FDqbnElM7mgmgqbIKBFHRpS1dvpt6sHD"). To know your valid API Key, open https://api.sap.com/api/API_BUSINESS_PARTNER, then Log On and choose Show API Key).
- Run the App.main() method (in Visual Studio Code, choose the Run button just before the definition of the method).