Let's see an end to end demonstration for creating the CAPM project, entity, service with annotations, create the entry via Post man tool and Preview the Application in Fiori.
Below mentioned detailed points covered in this Blog,
- BTP Cockpit and its properties
- Creation of CAP Project
- Linkage of Entity to the HANA DB in the SAP HANA Cloud central
- Post man tool Authorization and Post Operation
- Preview in the Fiori Application
BTP Cockpit and its properties:
Create a BTP Cock PIT Trial account and Sub Account.
In the Instances and Subscription Add SAP HANA Cloud and SAP Business Application Studio.
Create a Space in the Cloud Foundry, which is a shared, isolated location with an organization (org) used to develop, deploy and manage application and services.
In SAP BTP Cockpit administrators navigate to security->Role collections, create or edit a collection, and add roles-derived from application templates-to define the granular access.
Creation of CAP Project:
In this Business Application studio create a Dev space and create a Project as mentioned below.
Once Project created a project with workspace created. Here I have created ENTITY_CRUD project. As per below image under DB Node we can create the entity and service for the entity create under SRV node.
gen
Auto-generated folder created during build; contains compiled artifacts from your CDS models. You normally don’t edit this manually.
.vscode
Holds VS Code-specific settings like launch configs and workspace preferences for development.
app
Used for UI/front-end apps (like SAP Fiori); contains HTML, UI5, or other frontend resources.
db
Defines your data model and database artifacts using CDS files (like itemrecordsdb.cds) and deployment configs (undeploy.json).
gen
Another generated folder used during build/deploy; stores intermediate files created by CAP tools.
mta_archives
Contains packaged .mtar files used for deployment to SAP BTP (multi-target application archives).
node_modules
Stores all installed npm dependencies required for your CAP project.
srv
Defines the service layer (business logic & APIs); CDS files like itemrecordssrv.cds expose entities as OData services.
.cdsrc-private.json
Local configuration file for CAP (like profiles, credentials); usually not committed to Git.
.gitignore
Specifies files/folders (like node_modules) that Git should ignore.
eslint.config.mjs
Configuration for code linting to maintain code quality and standards.
mta.yaml
Defines how the application is structured and deployed in SAP BTP (modules, resources, dependencies).
package.json
Main project config file listing dependencies, scripts, and metadata.
package-lock.json
Locks exact versions of installed dependencies for consistent builds.
README.md
Documentation file describing the project, setup, and usage.
An entity with Itemrecords created. Here I have used ‘manage, cuid’ from @sap/cds/manage which will create a UUID key for every record creation.
Create a service for itemrecords db which acts as an interface between your data models and outside the world like UI apps or external systems.
Once entity and service generated in the project deploy the project using cf deploy mta_archives/<file>.mtar bash commands. After successful deployment we can see service instances created in the BTP cockpit as shown below.
To link the created entity in BAS to SAP HANA Cloud create a service key for the <entity>-db instance as shown from the below steps.
Choose Entity_CRUD-db and click on the navigation panel where service key need to create. In this illustration I have created as ENTITY_CRUD-db-key.
Once service key generated, we can see the JSON file in the view parameter. This JSON file needs to upload in the SAP HANA explorer to link the DB.
Linkage of Entity to the HANA DB in the SAP HANA Cloud central:
Navigate to Subscribed SAP HANA CLOUD and create instances which allows you to use in-memory computing for real-time transactional and analytical processing. Once instance is created it should be in Running status which indicates Active, available for SQL connections and able to perform data processing, backups and administrative tasks.
Now, open the SAP HANA database Explorer in the SAP HANA cloud central, click on the + icon where instance type to be chosen as HDI container and choose Apply from JSON string where need to paste the JSON file from the service key entity in the BTP cockpit.
Once JSON file applied Entity from the BAS linked to the SAP HANA Cloud central.
Post man tool Authorization and Post Operation:
To Authenticate authorization in the Post Man tool go to <entity>-auth in the BTP cockpit as shown below.
Here I have navigated to the ENTITY_CRUD-auth where service key SK-ENTITY_CRUD is created once service key created a JSON file generated with client ID, client secret, URL.
Client ID, URL client secret mapped to the Authorization in the post man tool and generate the Access Token.
Using post operation can create a data to the entity in the CAP project.
Successful created entries showing in the SAP HANA Cloud central.
Preview in the Fiori Application:
To Preview the data in the Fiori application, In the CAP project search with Open Application Generator and create a List Report page.
Once Application created, In the project terminal using Cds watch –profile hybrid can view the preview of the Application in Fiori
Required Annotations can use in the srv which will be reflect in the Fiori Application.
Conclusion
This demonstration showcased the seamless integration between SAP Business Application Studio, SAP HANA Cloud, and the Fiori front-end. By leveraging annotations and the CAP service layer, we successfully created a functional CRUD application with automated UUID management and secure API access. You are now ready to extend this project with custom business logic or complex UI enhancements.