Skip to Content
Technical Articles

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:

Be the first to leave a comment
You must be Logged on to comment or reply to a post.