Skip to content

Latest commit

 

History

History

create-cap-application

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 

Create SAP Cloud Application Programming Model (CAP) Project Using SAP Business Application Studio

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 SAP Business Application Studio

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.

Create Dev Space in SAP Business Application Studio

To create dev space for building a Full Stack Cloud Application, follow these steps:

  1. Create dev space with the application type Full Stack Cloud Application.
  2. Once the Dev Space is created, the status is changed from Starting to Running.
  3. Choose the dev space name to open it.

See Full Stack Cloud Application.

Import Project

  1. Download the CAP project file.
  2. Make sure there is an open workspace in your dev space. If there is no open workspace:
    1. Choose Open Folder.
    2. Select projects from the list provided in the command palette.
    3. Choose OK.

  1. 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.

HDI Artifacts

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.

  1. The hdi roles, view specifications are defined under db/src/dwc.

  1. 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.

  2. SAP Datasphere Space ID is specified in the synonym file to set the target. Make sure to adjust it to your Space ID.

  1. The user-provided service is configured in mta.yaml file as one of the resources.

  1. If needed, change the service-name to the name of the user-provided service which is created earlier.

  2. The HDI container is configured in the mta.yaml file and uses the database ID from SAP Datasphere.

  1. 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.

  1. Update the database_id to your SAP Datasphere database id in the mta.yaml file and Save it.

  2. 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:

OData End Point

  1. 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.

  1. The service model is defined in cap-service.cds which will expose the CDS entity above as OData service.

  1. Authentication role is specified in the package.json file.

Summary

You have created an CAP project which reads and writes into the SAP Datasphere space and exposes an OData service for external consumption.