Most people I know who need to connect to S/4HANA data have a system to get it from. But sometimes there are connection issues, sometimes it's unavailable, and some people simply don't have one yet.
Here's how to quickly connect to demo data.
NOTE: For the most part, you will not be able to update the demo data.
Get Account and Key
First go to SAP Business Accelerator Hub and make an account, or log into your existing account. If you are logged in, you will see your name in the top right.
Click on the dropdown arrow, and select Settings.
On the settings screen, click Show API Key.
A pop-up opens with your key. Put the key aside.
Create a Destination
For the sake of this blog post (@qmacro😉), I will use the URL to the Sales Order API, which is an OData API, but you could go through all the APIs for all the products and use whatever you want (I'll show you how below).
Go to your BTP cockpit – I will use my trial account on which I already installed SAP Build Apps.
Go to Connectivity → Destinations, and then create a destination with the following values.
The important thing is that you have to pass the API key as a header, and you can do that with the Additional Property URL.headers.apiKey (you can send other headers, just change the last part of the property name).
Using in SAP Build Apps
At this point, the process in SAP Build Apps is the same as when you use any destination in SAP BTP.
Enable SAP BTP Authentication in the Auth tab.
In the Data tab, go to Add Integrations → BTP Destinations, and then select your destination.
After selecting, you will see all the entities for the OData service.
Now do the following:
Click Install Integration.
Select the entities you want and, and for each click Enable Data Entity.
Click Browse Real Data to check that you are getting back data.
Click Save in the upper right.
Click the UI Canvas tab, and click Variables and create a data variable for the Sales Order entity.
IMPORTANT: When I checked, there were 368,976 records in the entity – you can see this when you browse the data – so if you try to bring them all back, your app will crash (or get stuck). In the logic of your data variable, configure paging for the Get Record Collection flow function, to bring back just 10 records per page.
Go back to the View slider, add a list view, and bind the data variable to your primary and secondary fields. I used SoldToParty and TotalNetAmount.
Run the app, and you will see a list of sales orders, with the customer and the amount.
Getting API URL from SAP Business Accelerator Hub
Once you get to the SAP Business Accelerator Hub, you can navigate to the product of your choice, say S/4HANA Cloud.
The you can click APIs, then the type of API, for example, OData V2, and then you can search for what you want, for example, Sales Orders.
And on the Overview tab of the API you are interested in, click Configuration Details and you will see the URL to that API.
I'm sure (no guarantees) in the not-too-distant future, you will be able to access all this API information from within SAP Build Apps.