In this article, we’ll look at how, for the simplest cases, it’s possible to create RAP Business Objects without code.
The principle: start with a table, and automatically generate all the objects required to create a RAP BO.
This feature enables you either to create RAP BOs from scratch for the simplest cases, or to speed up the most complex developments by quickly generating all the necessary objects to be modified.
1. Table creation
On Eclipse ADT :
Here’s the example table
@EndUserText.label : 'TEST1'
@AbapCatalog.enhancement.category : #NOT_EXTENSIBLE
@AbapCatalog.tableCategory : #TRANSPARENT
@AbapCatalog.deliveryClass : #A
@AbapCatalog.dataMaintenance : #RESTRICTED
define table ztest_crt_1 {
key client : abap.clnt not null;
key id : sysuuid_c22 not null;
text : abap.char(50);
local_last_changed : abp_locinst_lastchange_tstmpl;
created_by : abp_creation_user;
created_at : abp_creation_tstmpl;
change_by : abp_lastchange_user;
change_at : abp_lastchange_date;
}
Please note: these fields are required for automatic object generation:
local_last_changed : abp_locinst_lastchange_tstmpl;
created_by : abp_creation_user;
created_at : abp_creation_tstmpl;
change_by : abp_lastchange_user;
change_at : abp_lastchange_date;
2. Generate RAP objects
Then right-click on the table -> Generate ABAP Repository Objects
Then OData UI service as we want to create a Fiori application (also possible to create only a Web API without UI).
All the following objects will be generated
All this creates an OData V4 service that we can publish:
You can now preview your Fiori application.
As mentioned above, these generated objects can then be modified. Here, for example, if you want the UUID to be generated automatically by the system when a new entry is created, you need to modify the Behavior Definition.
You can now easily generate a Business Object RAP from a database table.