Build a Simple SAP RAP Application
1. Create a Table
Right click on the package and chose New > Other ABAP Repository Object
Chose Database Table, click Next
Enter Name and Description. Click Next.
Select a TR and Click Finish. If you do not have existing TR, create a new request.
Add the table fields after client field.
Activate the table. At this point the table will not contain any data.
Defining the CDS View
The core of any RAP List Report is the CDS view, which defines how data is structured and retrieved. In
our case, let’s assume we're building a report that displays students details.
To create a new CDS view, right-click the table view in ADT, select 'New Data Definition,' and define
how the data will be structured for the report
After selecting 'New Data Definition,' enter the package, name your CDS view, and provide a
description. Once completed, click 'Next' to proceed
Choose 'Define View Entity' as the CDS view type and click 'Finish' to create the initial structure of the
CDS view
The CDS view has been created, but it contains some initial errors. These errors are common and can
be resolved by adding the necessary annotations
To clear the errors, add the required annotations such as @Semantics.amount.currencyCode. These
annotations ensure the proper functionality of the CDS view
Add meta data extensions
Metadata extension is created to annotate the CDS Entity and fields. We add description, screen position
details etc., through these annotations.
Locate your CDS entity in the Package under node Core Data Services > Data Definitions. Right click on the
Entity and Choose Metadata Extension
Enter Name, Description and Extended Entity as Interface defined in CDS and chose Next.
Chose a TR and click Finish
Complete the Metadata Extension as below.
Create a Behaviour Definition
Behaviour Definition is created to specify operation details that are possible for the Entity. This refers to CRUD
operations. By default, READ / QUERY operations are enabled.
Right click on CDS Entity and choose Behaviour Definition.
All details will be populated. Default implementation type is managed. We do not need to change it for this
example. Click Next.
Choose a TR and click Finish.
Definition is created as below.
Activate.
Creating the Service Definition and Binding
Once the CDS view is ready, the next step is to expose it as a service.
Service Definition:
This is where we define which entities are exposed as part of the OData service.
Right-click the CDS view you just created, then select 'Service Definition' to begin exposing the data as an
OData service
In the next screen provide the service definition details and source type as definition and in referenced object
your cds view entity name and click on next and finish.
Your finish screen will be below and activate it.
Service Binding:
The binding step defines how the service is consumed, either for UI purposes (Fiori apps) .
Right-click the service definition that was created and select 'Service Binding' to define how the service will be
consumed
Fill in the package, service binding name, description, and select the binding type 'ODATA V2 – UI’ andgive the
service def. that you have created prev. step and finish and activate.
Publish the service binding to make the OData service available for consumption in SAP Fiori or other
applications
Once the service binding is activated, you'll see options to preview the application and create a Fiori app. Use
the 'Preview' button to view the application before deploying
The below preview will be done in the browser.
Press GO
Data Preview On Table
Click On Create Button
Entry Screen Will be opened
Enter Details and Press on CREATE
It will be updated in the table as well
Table View