Generate the transactional UI service

Before starting this tutorial, we hope you’ve completed the prerequisite tutorials.
Create your OData v4-based UI services and RAP business object (BO) along with all the necessary ABAP artifacts—such as CDS view entities, behavior definition, and implementation—using the built-in ADT generator. The resulting business service will be transactional, draft-enabled, and equipped with UI semantics for generating the Fiori elements app

Right-click your database table and select Generate ABAP Repository Objects

Select OData UI Service and click Next

Give package name and click Next
Under Data Model, give CDS Entity Alias as “Travel” and click on Next.
The above image displays a list of objects that will be created when you click the “Next” button.
Go to project explorer and see list of objects created(If not visible, refresh package)

Here’s a brief overview of the generated artifacts for the various RAP layers: Base BO, BO Projection, and Business Service.

Base Business Object
Object NameDescription
ddls iconZR_RAPTECH_TRAVELThis data definition defines the data model of the root entity Travel which is the only node of our business object
bdef iconZR_RAPTECH_TRAVELThis behavior definition contains the definition of the standard transactional behavior of the base Travel BO entity. It is a managed and draft-enabled implementation.
tabl iconZRPTECH_TRAVEL_DThis database table is used to temporary store the data from draft travel instances at runtime. It is managed by the RAP framework
class iconZBP_R_RAPTECH_TRAVELThis ABAP class which provides the implementation of the behavior defined in the behavior definition  ZR_RAPTECH_TRAVELof the base Travel BO.
BO Projection
Object NameDescription
ddls iconZC_RAPTECH_TRAVELThis data definition is used to define the projected data model of the root entity Travel relevant for the present scenario. Currently almost all fields of the underlying base BO view are exposed and the definition of metadata extension is allowed using the view annotations @Metadata.allowExtensions: true.
bdef iconZC_RAPTECH_TRAVELThis behavior definition exposes the part of the underlying base Travel BO entity which is relevant for the present scenario with the keyword use. Currently all standard CUD operations are exposed.
ddlx iconZC_RAPTECH_TRAVELThis metadata extension is used to annotate view ZC_RAPTECH_TRAVEL and its elements with UI semantics via CDS annotations.
Business Service
Object NameDescription
srvd iconZUI_RAPTECH_TRAVEL_O4A service definition is used to define the relevant entity sets for our service and also to provide local aliases if needed. Only the Travel entity set is exposed in the present scenario.
srvb iconZUI_RAPTECH_TRAVEL_O4This service binding is used to expose the generated service definition as OData V4 based UI service. Other binding types (protocols and scenarios) are supported in the service binding wizard.

Adjust metadata extension

Open your metadata extension   ZC_RAPTECH_TRAVEL and adjust it.

The field attachment is a raw string (data type RAWSTRING) and cannot be used in the filter bar, so the annotation @UI.selectionField is not allowed for this field and should be removed. Therefore, remove following annotation block for the field attachment:(if it is not present, then ignore)
@UI.selectionField: [ {
    position: 10 
  } ]
Save and activate.

Publish and Preview the Travel App

Publish the local service endpoint of your service binding in the Service Binding editor and start the Fiori elements App Preview.

Open your service binding ZUI_RAPTECH_TRAVEL_O4 and click Publish

Double-click on the entity Travel in the Entity Set and Association section to open the Fiori elements App Preview
Click on Go button

Congratulations on completing the tutorial! 🎉 It’s a great moment of achievement, and you should be proud of the progress you’ve made. You’ve learned new concepts, built something valuable, and taken another step toward mastering your skills. Keep up the great work, and don’t hesitate to dive into the next challenge! Happy coding! 😊

Leave a Comment

Your email address will not be published. Required fields are marked *