Use the CAP model to create Fiori applications in the SAP cloud platform ABAP programming environment

Use the CAP model to create Fiori applications in the SAP cloud platform ABAP programming environment

Create the necessary CDS view, activate, and then create a behavior definition based on the CDS view:

@Semantics.user.createdBy: true
key holiday_id,
@Semantics.user.lastChangedBy: true
month_of_holiday,
@Semantics.systemDateTime.createdAt: true
day_of_holiday,
@Semantics.systemDateTime.lastChangedAt:true
changedat
 

The CDS view based on the behavior definition is the previously created ZCAL_I_HOLIDAY_JERRY:

The implementation code of this behavior definition is as follows:

managed;//implementation in class zbp_cal_i_holiday_jerry unique;

define behavior for ZCAL_I_HOLIDAY_JERRY alias holidayRoot
persistent table ZCAL_HOLIDAY_001
lock master
/*
This defines the root node as main locking object to avoid multiple persons editing the same object.
Sub nodes have to be defined as lock dependent later on.
*/
//authorization master ( instance )
//etag master <field_name>
{
  create;
  update;
  delete;
}
 

Create service definition based on data definition:

In the Service definition, expose the CDS view and rename it to HolidayRoot:

Then create service binding based on service definition:

If you encounter a syntax error, go back and check whether your behavior definition or service definition is not activated.

After the service binding is successfully created and activated, you can use the preview button to open the corresponding Fiori application:

To get more Jerry's original articles, please follow the public account "Wang Zixi":