In the blog How to consume Sap Business One API Hub APIs from SCP WebIDE we saw how to create a SAPUI5 application directly connecting to SAP Business One API Business Hub APIs. In this blog I will like to show you how easy it is to change destinations in your SAPUI5/SAP Fiori app to connect to your real SAP Business One Service Layer backend system.
By following the simple steps proposed here you will get your application configured in order to call your SAP Business One Service Layer:
1. Define a Destination
In order to point to your real SAP Business One backend system you will need to define a Destination in your SAP Cloud Platform account pointing to your SAP Business One Service Layer. This destination can directly point to your server (using reverse proxy for example) or you can use the SAP Cloud Connector in order to secure a tunnel between your SAP Business One server and the SAP Cloud Platform. You can find more details about the SAP Cloud Connector in several documents like the blog Cloud Connector – A Brief Guide for Beginners.
To learn the basics on how to create a Destination in the SAP Cloud Platform please read the blog Create a Destination on SAP Cloud Platform before continuing with this document. Check also the official HTTP Destinations documentation on help.sap.com to get more details.
In our specific case for SAP Business One Service Layer connection the destination should look like this if you are using SAP Cloud Connector:
Note: With Cloud Connector the Proxy Type is OnPremise.
The following screen shows a direct connection to your SAP Business One Service Layer over Internet:
With direct internet access (or reverse proxy) to your SAP Business One Service Layer the Proxy Type is Internet.
Please note that you require Server Certificate Authentication for HTTPS URL.
As a workaround and on a testing environment only you can connect via http to a specific Service Layer node as follows. In this case you don’t require a Trust Store but your Service Layer http port needs then to be open and not secured.
2. Modify the manifest.json file in your SAPFiori/SAPUI5 app
Your manifest.json should look as follows when you connect to SAP API Business Hub APIs: the dataSources element points to the /apihub_sandbox/sapb1/ destination.
Change the dataSources element in order to point to your SAP Business One backend as follows, where B1SL_Summit2018 is the destination defined in the previous step.
3. Modify the neo-app.json file in your SAPFiori/SAPUI5 app
Edit the neo-app.json file in your SAPFiori/SAPUI5 application and look for the /apihub_sandbox path.
You need to:
- Change the path pointing to “/apihub_sandbox” to your destination path (in my case /B1SL_Summit2018).
- Change the type to “destination” and give it a name.
- Remove the entryPath element.
Once these changes implemented run you application again, the data will be retrieved from your real SAP Business One backend instead of the SAP API Business Hub sandbox.
This blog is based on the series of blogs Discover, Explore and Consume SAP S/4HANA Cloud APIs in SAP API Business Hub published by Divya Mary. Thank you Divya for sharing such great content!
Please share with us your feedback and extra findings on this topic!