Technical Articles
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(It is required to handle for non-standard action, features, determination, validations and so on that will be covered in coming Part-2)
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 🙂
Hi Rajat,
Nice blog.
One small correction in the note section, it is wrongly stated that behavior implementation class is not required for managed implementation (Step 4).
It is required to handle for non-standard operations(actions), authorizations, features, determination, validations and so on.
Thanks,
Pavan
Hi Pavan,
Thanks for the suggestion,
Point considered.
Best Regards,
Rajat Verma
Hi Rajat,
Thanks for sharing. Nice Blog.
HI Rajat,
I have tried the same but getting an insufficient auth issue. Do u have any idea?
Thanks,
Praveen