The CAP application reads master data as a view from SAP Datasphere Space, writes transactional data into it using an HDI (HANA Deployment Infrastructure) container, and then makes this data available for SAP Build Apps to use through an OData service.
Open the SAP Business Application Studio from the SAP BTP cockpit, create a development space, and import your MTA (Multitarget Application Development) CAP project. This will allow you to start working on your project within the development environment.
To create dev space for building a Full Stack Cloud Application, follow these steps:
- Create dev space with the application type Full Stack Cloud Application.
- Once the Dev Space is created, the status is changed from Starting to Running.
- Choose the dev space name to open it.
See Full Stack Cloud Application.
- Download the CAP project file.
- Make sure there is an open workspace in your dev space. If there is no open workspace:
- Choose Open Folder.
- Select projects from the list provided in the command palette.
- Choose OK.
- From the Get Started page, choose Import. Choose the downloaded file, and then choose Open.
Hint: If you do not see the Get Started page, enter Get Started in the command palette.
See Importing Projects.
To access the data from SAP Datasphere, you should specify the HDI roles, views, specific actions (read/write/select), SAP BTP user-provided service and HDI container to point to datasphere database.
- The hdi roles, view specifications are defined under db/src/dwc.
-
If needed, change the SAP BTP user-provided service name in this file to the name of the user-provided service which is created earlier. Similarly, the SAP Datasphere master data view name should be adjusted accordingly. See Create Master Data Table and Views in SAP Datasphere Space.
-
SAP Datasphere Space ID is specified in the synonym file to set the target. Make sure to adjust it to your Space ID.
- The user-provided service is configured in mta.yaml file as one of the resources.
-
If needed, change the service-name to the name of the user-provided service which is created earlier.
-
The HDI container is configured in the mta.yaml file and uses the database ID from SAP Datasphere.
- In SAP Datasphere, choose System from the side navigation area, choose About, and save the Database which is used to configure the HDI container in the mta.yaml file.
-
Update the database_id to your SAP Datasphere database id in the mta.yaml file and Save it.
-
DWC_HDI is given as a schema name in the mta.yml file which will be available in the SAP Datasphere space once this application is deployed.
See:
- Access Space Objects in Your HDI Container
- Allow Your Space to Write to Your HDI Container
- Blog Post: Expose SAP Datawarehouse Artifacts
- The annotation @cds.persistence.exists lets the CAP model know that there is an entity already existing with the same name and it should not create a new entity.
- The service model is defined in cap-service.cds which will expose the CDS entity above as OData service.
- Authentication role is specified in the package.json file.
You have created an CAP project which reads and writes into the SAP Datasphere space and exposes an OData service for external consumption.