Updated: 16 August 2024 - Updated setup steps for SAP HANA Cloud, added link to blog post covering SAP Build Apps booster, included update on sample data and use of Joule for generating data.
Updated: 1 August 2024 - Removed the step to enable SAP BTP Authentication, as this is now enabled by default in SAP Build Apps.
This blog post is the first in a short series of posts that cover the connectivity options available for SAP Build Apps to interface with SAP systems. The series will cover connecting SAP Build Apps with the following:
The format of this post is similar to a tutorial. However, I'll provide more comprehensive details, tips and the opportunity for you to provide feedback. Based on the feedback we will be able to adjust and enhance this post and future parts of the series, and might even be able to improve the products involved as well.
Before we get into the details of setting up connections between SAP Build Apps and SAP Systems, I intend to introduce a couple of SAP technology components in each post that are relevant for the use cases covered in the series.
The common building block for connectivity on the SAP Business Technology Platform is called BTP Destination. A BTP Destination is a predefined endpoint that enables you to connect to different cloud and on-premise applications and services.
For creating a destination, we have the following options:
In this blog series we will use some of these options.
In the scenario described in this blog post, we will make use of a CAP service created in SAP Business Application Studio. Deployment of the service is done through an MTA (Multi-Target Application) deployment that allows you to deploy applications consisting of several modules. The MTA descriptor includes information about the destination to be created. Alternatively, we could also manually create a destination via the Destinations Editor available in the BTP cockpit.
For this use case, we will create a very basic CAP project in SAP Build Code as a starting point (was SAP Business Application Studio using Productivity Toolkit). After the General Availability of SAP Build Code, I've decided to rework this blog post to reflect the latest commercial offering. Take note that I will keep the format of the blog post as much as possible unchanged. In some cases I will make use of SAP Joule to further enhance the development experience. But these are not a mandatory features. Also, users who have access to SAP Business Application Studio (which does not include SAP Joule) should still be able use this blog post.
For those who want to follow along, here are the steps:
Select SAP Build Code.
Provide a project name (note: use lower case) and name for the dev space.
Within a couple of minutes, your cloud development environment is provisioned and the project is created. You can then open the development environment by selecting the link (project name).
For sample data, we create a table with 25 items:
In case you are using SAP Build Code with Joule enabled, you can actually generate a nicer list of sample data. Hit the Enhance button and use the follow prompt:
/cap-edit-data #test/data/blogproducts-Products.csv Generate sample data for an electronics shop
Not sure with which currency Joule is working, but this is good enough for sample data.
Accept the proposed data.
Note that we did not create any UI application until now. For testing purposes, we could add a UI application based on Fiori Elements or MDK. However, for our use case, we are going to build a UI application using SAP Build Apps.
We will now proceed to deploy the service onto BTP, by following the steps below:
Once the build and deploy process succeeds, you will be provided with a URL to the project overview page. (https://<yourtargetsubaccount>.launchpad.cfapps.<yourtargetregion>.hana.ondemand.com/lcap<namespace.namespace>Launchpad-1.0.0)
Let’s try to open this in a new incognito browser tab. You will be required to sign in. Only authenticated users will be able to access the launchpad application on BTP.
When you click on the Products service’s ‘code’ button, you will see information about the OData context, and the initial data available in the service.
During the deployment, some files were created that are related to the security configuration of your service.
In the File Explorer, you will find the following files in the project’s folder structure:
In the subaccount's “Services > Instances and Subscriptions” list, you will find instances for:
In your BTP subaccount, you will also notice that the deployment process has created several Destinations that are defined in the mta.yaml file. Some are related to a UI application that we actually did not create, so please ignore those.
Checking the configuration of the destination “blogseries-blogproductssvc” shows:
A few things to note here:
In order to easily consume the service in SAP Build, we will need to reconfigure the destination. To help you with that, you might have seen an item in the popup menu where we had triggered the deployment.
Go back to the Project Explorer, click on the 3 dots behind the project name and select “Enable Discovery to SAP Build”.
Alternatively, you can find the corresponding task in the Task Explorer.
The changes will only take effect after deployment. Hence, you are asked whether you want to deploy now. Click Yes to confirm this.
After deployment, the destination’s properties will be updated (you might have to reload the web page):
We will now move to SAP Build Apps and create a UI application on top of the CAP service we have created in SAP Build Code (or SAP Business Application Studio).
SAP Build Code subscribers: navigate back to the SAP Build Lobby.
SAP Business Application Studio subscribers: open the link to SAP Build Apps in the subaccount's list of subscribed applications. This will open the SAP Build landing page (aka Build Lobby).
From here, create a new project by selecting the "Create" button, followed by selecting "SAP Build Apps".
Select "Web & Mobile Application".
Provide a project name.
This will open your newly created project in SAP Build Apps.
The generated application will have BTP Authentication enabled out-of-the-box, including a dedicated page for handling the authentication.
We will now navigate to the Data tab, where we can see “No systems integrated”. Select the “ADD INTEGRATION” button.
Select SAP Systems, followed by BTP DESTINATIONS.
In the list, you will see the destination we have created and updated to make it visible here
After selecting the destination, you can browse the details. In this case, you will see the Products entity, its fields and capabilities.
We can browse the data stored in the service, and we can even add another record.
To use your destination in your application, select “INSTALL INTEGRATION”. Also select the button ENABLE DATA ENTITY. This will ensure you can use this data entity in your project. Remember to SAVE your changes.
Let’s create a simple UI application that shows the Products available in the service. On the UI CANVAS tab, toggle from VIEW to VARIABLES.
Select the DATA VARIABLES tab and select ADD DATA VARIABLE. Select the Products and provide a name for the data variable (in my case, I am using ProductsList). As data variable type, keep the default “Collection of data records” selected.
The list of products shown in your application will not automatically update once you add new products. In order to see an updated list after adding new products, please connect the EVENT “Page focused” to the DATA “Get record collection” in the logic canvas.
Switch the UI CANVAS back to VIEW and drag and drop a List item onto the canvas. Select the property Repeat with and select the ProductList.
Now that we have our initial app, let’s see how this runs. For this, we will use the Preview. Select the Launch tab and select Preview your app. Then select Open preview portal. This will make the app available in the preview portal.
There are two ways to consume the app available on the preview portal: using your PC’s browser, or via a mobile preview app you can download from the public app stores.
As an authenticated user, you should be able to preview your app.
Note: In case you are using your mobile device, ensure you have selected the correct edition / region to login.
In this use case we have created a simple CAP-based service in SAP Build Code that only requires a user to authenticate with the platform to access the data exposed through this service. We have exposed the service to the platform users through a BTP destination and made it discoverable for SAP Build Apps. In SAP Build Apps, we have added an integration to the CAP service through the destination. The destination forms the bridge between the CAP-based service and the applications consuming it. This is an example of a fusion development use case, showcasing how developers with different skill sets and tools can work together to develop a full-stack apps.
In the next blog post, we will enhance the CAP-based service and introduce role based access control for the service. We'll also take a quick look at XSUAA, and how we to configure the custom IdP (IAS).
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
27 | |
25 | |
19 | |
13 | |
13 | |
11 | |
10 | |
8 | |
7 | |
6 |