Skip to Content
Technical Articles
Author's profile photo shiromani soni

SAP Cloud Application Programming Model – EP2

Setting up CAP Project:

Let’s create a project by opening up a new Terminal in CAP and executing the command cds init EP2 in the terminal.
After command execution, we can see the project structure is created in workspace with following folders for services(srv), database(db) and UI(app)
Now, we will create database entities using file schema.cds inside as shown below:
Following entities are created in schema.cds
namespace sap.com.employeeRecord;
 
entity employee{
  key ID   : Integer;
  name    :  String(100);
  department:  String(20);
 status: String(5);
}
 
entity employeeMaster{
  key ID   : Integer;
  status: String(5);
}
Create a sub-folder data in db folder.
Also create a file sap.com.employeeRecord-employee.csv with below information inside data folder.

 

Create a Service file in SRV folder: cat-service.cds with the following code
using { sap.com.employeeRecord as my } from '../db/schema';
service CatalogService @(path:'/browse') {
entity Employee as SELECT from my.employee;
}
Use cds watch to start a cds server, in a newly created project.
Execute cds watch from the Terminal to see the output.

I hope this blog would be useful for everyone looking forward to work on SAP Business Application Studio,please do share your views on this.

References:

Episode 1: Click here for Episode 1

Episode 3: Click here for Episode 3

Git Setup: Click here for Git Setup

Connect Hana cloud with SAP Business Application Studio: Click Here for Connection Blog

 

 

 

Profile on SAP Community:

Assigned Tags

      1 Comment
      You must be Logged on to comment or reply to a post.
      Author's profile photo Udita Saklani
      Udita Saklani

      hi shiromani soni

      I have created two schemas and now I want to associate the entities belonging to 2 different schemas.
      Is this possible?

      If yes can you share the syntax.

       

      Regards,

      Udita