Part 0: How to build an extension application for SAP S/4HANA Cloud using CAP, SAP Cloud SDK and SAP Fiori elements
SAP S/4HANA Cloud customers have their own specific business needs. Some of these business needs can be implemented using In-App Extensibility, but some of them require Side-by-Side Extensibility. This blog post series covers how to do Side-by-Side Extensibility by building an application on SAP Cloud Platform.
What to expect from this blog post series?
The purpose of this blog post series is to showcase the end-to-end technical knowledge of building an extension application using the mentioned technologies. The application will follow a simple business scenario and will focus on implementation steps.
I will cover a step-by-step tutorial with code snippets, screenshots and explanations of how to develop and configure the application.
It has been a very interesting journey for me to develop this app and I wanted to share my discoveries because I did not find a blog post that covers this scenario. Please feel free to leave feedback, suggest alternatives or ask questions. My goal here is to have a end-to-end scenario covered and available. I’m a 100% open for improving or expanding it, so any contributions are welcomed!
What’s the business scenario?
In the SAP S/4HANA Cloud system we have Business Partner Master Data. Let’s imagine we want some end-users to be able to modify the Addresses of these Business Partners.
Part 0: Preparations
This blog post will cover the prerequisites and the preparation steps which are needed before starting to implement the application.
What are the prerequisites for this part?
- Postman – https://www.postman.com/downloads/
- SAP S/4HANA Cloud system
SAP S/4HANA Cloud system access is needed, but the initial steps can be done using the SAP API Business Hub sandbox. So don’t give up yet if you don’t have access!
SAP API Business Hub
We want to extend the SAP S/4HANA Cloud system, so we need a way of communication between it and the app. SAP S/4HANA Cloud can expose data through APIs, which will be consumed by the app. You can use SAP API Business Hub to look for the API that corresponds to the Business Partner Master Data.
Steps to follow:
- Go to https://api.sap.com/ and select SAP S/4HANA Cloud.
- In the left panel, choose Type OData.
- Type business partner in the search and press Enter. Choose Business Partner (A2X).
- You can test the API here, or use Postman to test it also. Press on Details tab to find out more about this API and to take the needed information for activating it in the S/4HANA Cloud system.
- From the Details tab, copy the Communication Scenario SAP_COM_0008. It is needed in the creation of Communication Arrangement.
SAP S/4HANA Cloud configurations
This part covers how to create a Communication Arrangements, Communication Systems and Communication Users.
To access these Fiori apps make sure you have Administrator business role (SAP_BR_ADMINISTRATOR).
* Please follow the naming conventions specific to your project, the naming used was just for demo purpose.
Steps to follow:
- Go in SAP S/4HANA Cloud and look for the Fiori App “communication arrangements” by typing in the search bar and clicking on the app.
- Choose New
- Choose SAP_COM_0008 in Scenario. For Arrangement name you can put in some text also to recognize it, but it is useful to keep the name of the communication scenario. Then press Create.
- Choose New for Communication System
- Write a system ID and Name, then press Create
- For Host Name write localhost and for Logical System and Business System also write a string
- Scroll down to Users for Inbound Communication and press on the + button
- Press on New User button
- Write user name and description and press on Propose Password. Copy the Proposed Password somewhere and do not lose it. Then Press on Create.
- Then choose the DEMO_USER or the name that you gave to the newly created user.
- Press OK
- Then scroll down again to Users for Outbound Communication and press on “+”.
- Create a dummy user name and password:
- Press on Save. You will be taken back to the Communication Arrangements and you will see that the Communication System and Inbound communication User Name were auto-completed with the ones you just created.
- Here, you scroll down to Inbound Services and copy the Service URL for Business Partner (A2X) OData V2: https://my306116-api.s4hana.ondemand.com/sap/opu/odata/sap/API_BUSINESS_PARTNER
- For the purpose of the app, you can deactivate all of the Outbound Services by deselecting the Active checkbox for Service Status like this:
- Then press save and you should see this
API Testing in Postman
This part covers how to test the SAP S/4HANA Cloud API which we exposed in the previous step.
- Go to Postman and press on the + button to create a new request. This should be what you see:
- Paste the URL you saved from the communication arrangement. Choose the Authorization tab and select Type: Basic Auth. Paste the username and the password which you saved when creating the communication user. You should see this:
- Response should look like this:
- Quick note, if later you want to test the POST request, first do a GET/HEAD request in which you put in the header X-CSRF-Token with value Fetch. Then take the X-CSRF-Token response header value and use it in your POST request.
Now you know how to:
- look for the SAP S/4HANA Cloud APIs in SAP API Business Hub
- activate those APIs by creating a communication arrangement, system and user in SAP S/4HANA Cloud
- test the activated APIs in Postman
In the next blog post from this series I will cover how to:
- develop an application with SAP Cloud Application Programming Model
- configure, build & deploy to SAP Cloud Platform