

ABAP RAP(RESTful Application Programming) Model, Part- 1 –> Managed scenario
source link: https://blogs.sap.com/2023/01/04/abap-raprestful-application-programming-model-part-1-managed-scenario/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

ABAP RAP(RESTful Application Programming) Model, Part- 1 –> Managed scenario
In this blog, you will learn how to create a simple RAP model. In this example, we will create a table, CDS view entity, Metadata extension, Behavior definition, Service definition, Service Binding.
We will create below application for creation of Driver detail with the help of FIORI element.

Step 1 –> Create table – ZRV_RAP_DRIVER
Right click on the package –> New –> Other ABAP Repository Object –> Select Database Table and enter the the name of the table.

Here is the code snippet.

Step 2 –> Create Root CDS Entity ZI_RAP_DRIVER
Right click on the package –> New –> Other ABAP Repository Object –> Select Data Definition and enter the the name of Root CDS Entity –> Select Define Root View Entity.

Here is the code snippet.

Step 3 –> Create a Metadata Extension
Right click on root view entity –> Select New Metadata Extension –> Enter the the name of Metadata Extension.

Here we annotate the CDS Entity and fields we add screen position, set selection field etc.
Here is the code snippet.

Step 4 –> Create a Behavior Definition
Right click on root view entity –> Select New Behavior Definition.
All detail will be already filled, just click next.

Here is the code snippet,
Note –> For managed scenario we don’t need a class. Create, Delete, Update functionality will work as a standard.

Step 5 –> Create a Service Definition
Right click on root view entity –> Select New Service Definition

Here is the code snippet.

Step 6 –> Create Service Binding
Right click on service definition –> Select New Service Binding.
Here we need to choose Binding type OData V2-UI or OData V4-UI, for now we have chosen V2-UI.


Now publish the Service by clicking on Publish button.

Our RAP model is completed, now test the application.
Test Application –>
Select Service and click on preview button.

Click on Go –> To see the data, if already available in system.

Click on CREATE –> Here we can create new driver.

UPDATE / DELETE –> To update or delete the record.
Select the entry from the list.

These buttons appear on the top right corner.

Conclusion –> After reading this blog you will be able to create simple RAP model application.
Give it a try and let me know in the comments if you need any help/support.
Please feel free to suggest if any correction is needed
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK