Technology Blogs by SAP
Learn how to extend and personalize SAP applications. Follow the SAP technology blog for insights into SAP BTP, ABAP, SAP Analytics Cloud, SAP HANA, and more.
cancel
Showing results for 
Search instead for 
Did you mean: 
Dan_Wroblewski
Developer Advocate
Developer Advocate
I've helped many people in the community or during our recent CodeJam who were trying to connect SAP Build Apps to their SAP backend – like S/4HANA Cloud or SAP Sales Cloud, or SuccessFactors – and there seems to be a few misunderstandings of how SAP Build Apps works. So I want to clear some things up and show you how to quickly connect to S/4HANA Cloud.

Only Connect Via REST or OData


I've had people ask me how to connect SAP Build Apps with RFCs, or BAPIs, or CDS views or other methods. SAP Build Apps can make connections to REST and OData resources only, so if you can expose your data this way, you'll be OK.


Google Firebase is a special, legacy case (and I assume the connection is made via REST calls) and Marketplace search are preconfigured data resources in the Marketplace, themselves either REST or OData services.

NOTE: SAP Build Apps can connect to data stores built with SAP Build Apps: Either data models created with Visual Cloud Functions, or on-device data models that stores local data on the current device.

REST and OData Services Are Set Up in Different Places


I think the layout of the Data tab has caused some confusion of how to start connecting to backend data resources, especially if a destination is required.

The UI for selecting OData or REST services without a destination are right next to each other.


But if you are working with a destination, which most SAP developers are, the method for setting up the data resource is different and in different places.

For a REST call, you use the same "classic data entities" menu with most of the other data resources, and within the UI you select your destination.


But if you want to call an OData service, you need to add an "integration", whose UI is a little bit above and follows a different patter.


NOTE: If you want to work with destination, you must enable BTP authentication in the Auth tab.

Your Destination Must Point to OData Service Document


Specifically, someone came to me because they tried to connect their SAP Build Apps to SAP Sales Cloud. Now, I don't know anything about SAP Sales Cloud, but I still looked into it. To be honest, one OData/REST service is pretty much like the other.

Well they first created a destination to the system, and that did not work.

Then they created a destination to a specific OData entity, and that did not work.

That's because when you create a destination to expose OData in SAP Build Apps, you must provide the service document for a specific OData service, for example:
https://myServer.s4hana.ondemand.com/sap/opu/odata/sap/API_BUSINESS_PARTNER

In SAP Build Apps, this will expose all the entities within this specific OData service (Business Partners).


 

How to Connect to S/4HANA Cloud


I've written this before but I'd thought it couldn't hurt to do it again.

I am assuming that you set up a communication user or principal propagation, and set up all the permissions to your S/4HANA Cloud system. I used a technical user for the sake of explaining on SAP Build Apps works, but principal propagation will work, too.

  1. Create a destination pointing to your S/4HANA Cloud OData service – remember, to the OData service document – including all the proper additional properties.

  2. In SAP Build Apps, enable SAP BTP authentication in the Auth tab.

  3. In the Data tab, click Add Integration → BTP Destinations, and select your destination.

    • If the destination is not there, you did not set the additional properties.

    • If it is incompatible format, the URL is not an OData service.



  4. Now you can click Add Integration and select the entities you want to expose. You can view real-time data, and you can set up test data.


Then you use it like any other data resource in SAP Build Apps. You can see our recent challenge or one of my recent blogs to learn how to do dynamic sorting, filtering and paging on your data set.
1 Comment