My first steps with BTP destinations (S/4HANA) in AppGyver
I’m sure you’ve seen Marc Huber’s wonderful blog Using BTP Authentication and Destinations with SAP AppGyver – this is a big step forward for integrating SAP AppGyver in SAP Business Technology Platform, and I think the first of many giant leaps to come.
Now that I’ve gotten to work with the feature, I’d like to offer some tips for using it, and a quick example.
Setting Up Your Destination
I set up both S/4HANA and S/4HANA Cloud destinations. The destinations (with Basic Authentication) are essentially the same, though the setup before the destination is different.
Whatever you do, remember to define the following properties for the destination (without them they won’t appear in AppGyver):
- HTML5.DynamicDestination = true
- WebIDEEnabled = true
- Appgyver.Enabled = true
You must also understand that your destination must point to an OData service. This is different, for example, from SAP Conversational AI where you can have a generic destination pointing to the system and then specify a service and entity when you make specific calls. In other words, with AppGyver, you may need to set up multiple destinations if you call multiple OData services even in the same system (this may change in the future).
Of course, what’s really good is that AppGyver will now read the service metadata and let you discover the entities inside, and even browse the data.
If your an S/4HANA guru, this may be old hat, but I’d thought I’d just review how I set things up (after getting access to both front-end and backend systems, and getting the administrator role).
- Just to get it up and running quickly, easiest is to set up a technical user for accessing the APIs.
- Give the technical user the permissions for the APIs you want to access (e.g., for sales orders, I needed SAP_BR_INTERNAL_SALES_REP role).
- Set up the cloud connector. It’s pretty simple and there are a lot of blogs/guides for this.
- Add your subaccount (you’ll need BTP administrator access and maybe the cloud connector role)
- Add a Cloud to On-Premise channel to your S/4HANA system (you’ll need the host name and port of your front-end system, which you can get with the SMICM transaction).
- Specify the path you want to open (generally /sap/opu/odata).
- Create a destination:
The big difference here is that you don’t have to set up the cloud connector, but there are a few steps for setting up a user.
- Set up the S/4HANA user for accessing the API (the “communication arrangement”). For this, also, there are a lot of blogs/guides.
- Add a user with strong password (Maintain Communication User)
- Add a communication system that points to your S/4HANA system (Communication Systems)
- Add a communication arrangement that specifies what APIs can be called for a specific communication user (Communication Arrangement).
- Create a destination, like the S/4HANA one, but for “Internet” and with the URL to the S/4HANA front end:
Setting Up Destinations in AppGyver
The first thing you need to do is enable BTP authentication.
- Go to the Auth tab.
- Click Enable Authentication, and then select SAP BTP Authentication.
Now you can go into the Data tab, click Add Integrations, and finally select a destination.
From here, you get a screen for selecting the entities you want to work with in your app. In the background, AppGyver sets up the schema and other stuff you need to work with the data resources.
Whenever you go back into the Data tabs, you will see the entities you selected. You can double-click them, which opens the OData service from where they came, and you can select other entities and browse the data of any of them.
Creating the List-Detail App
In Marc’s blog, he used the new data adapter components to build the app, which is great. As an exercise, I am going to do the old-fashioned way.
- Create 2 pages, one for the list of BPs and one for the detail page. The detail page has a page parameter for the BP ID.
- On the list page, create the following UI:
- Create page variables for the alphabetize and filter values, as well as a variable for the current page number.
- Create a data variable from the business partner resource (one of the entities we defined from our destination).
- On the same page, in the properties area on the right, we can define simple filters, sorting and paging based on the page variables we created.
In the end, in just a few minutes, you get something like this using backend data:
Things to Think About
The following are things I want to do that I currently don’t know how or perhaps can’t yet be done:
- No authentication with destinations: This is not possible and may go against the long time idea of having IT create the destinations and make different destinations available to different “citizen developers” based on their permissions and expertise.
- Principal propagation: This apparently already works (I haven’t had a chance to test it).
- Data adapter and manual refresh: I have not found a way to manually refresh data when using data adapter components, except for actually reprogramming the data adapter composite component. This is not that difficult but doesn’t seem like the solution.
- Roles: You cannot currently assign roles to different users within your AppGyver app, but this is something on the roadmap, I am told.
- User Info: You cannot currently get the currently logged-in user, or other user details, but this also is on the roadmap, I am told.
- Run on mobile devices: The apps using destinations and running on BTP could theoretically be run on mobile devices but the tools to make this simple are not currently provided in AppGyver. I’m sure this is being worked on with SAP Mobile Services.
- Direct deployment to BTP: Currently, AppGyver will export to an MTAR file but you need to handle deploying it to BTP (e.g., with the CF CLI). The hope is that sometime soon you will be able to click a button and quickly/easily deploy to BTP.