SAP Builders Blog Posts
Learn from peers about their low-code journey and write your own blog posts to share your thoughts and experiences as you become an SAP Builder.
cancel
Showing results for 
Search instead for 
Did you mean: 
Dan_Wroblewski
Developer Advocate
Developer Advocate
2,509

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. Most is contained in this video:

 

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.

dan_wroblewski_0-1695196059280.png

Click on the dropdown arrow, and select Settings.

On the settings screen, click Show API Key.

dan_wroblewski_1-1695196153812.png

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. 

dan_wroblewski_0-1695197026659.png

The basic fields are:

NameAccelerator-Hub-Sales-Order
TypeHTTP
URLhttps://sandbox.api.sap.com/s4hanacloud/sap/opu/odata/sap/API_SALES_ORDER_SRV/A_SalesOrder
Proxy TypeInternet
AuthenticationNoAuthentication

The additional properties are:

Appgyver.Enabledtrue
HTML5.DynamicDestinationtrue
URL.headers.apiKey<your API key>

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.

dan_wroblewski_0-1695198326012.png

In the Data tab, go to Add Integrations → BTP Destinations, and then select your destination.

dan_wroblewski_2-1695198489096.png

After selecting, you will see all the entities for the OData service.

dan_wroblewski_1-1695198436430.png

Now do the following:

  1. Click Install Integration.
  2. Select the entities you want and, and for each click Enable Data Entity.
  3. Click Browse Real Data to check that you are getting back data.
  4. Click Save in the upper right.

Click the UI Canvas tab, and click Variables and create a data variable for the Sales Order entity.

dan_wroblewski_3-1695198799389.png

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.

dan_wroblewski_4-1695199017784.png

 

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.

dan_wroblewski_0-1695199416566.png

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.

dan_wroblewski_1-1695199507887.png

And on the Overview tab of the API you are interested in, click Configuration Details and you will see the URL to that API.

dan_wroblewski_2-1695199743831.png

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.

😺

 

 

 

6 Comments