Mentor SAP

Basic Operation UPDATE

Standard Operations in Behavior Definition

 

In RAP, update is one of the standard operations. Standard operations are also known as CRUD operations, which is an acronym for create, read, update, delete.

 

While the read operation is always implicitly enabled for each entity listed in a CDS behavior, the modifying operations have to be listed to be available.

 

To enable standard operation update for an entity, add the statement update; to the entity behavior body (curly brackets after statement define behavior for … ). To disable the operation, remove the statement or turn it into a comment.

 

In a managed scenario, the standard operations don't require an ABAP behavior pool, because they are completely handled by the RAP provisioning framework. In an unmanaged scenario, the standard operations must be implemented in the ABAP behavior pool.

 

Some interesting additions to statement update are as follows:

Internal

Prefix which disables the operation for external consumers of the BO.

 

Features: instance or features: global

Enable dynamic feature control. The decision, where and when the operation is enabled, is made dynamically in a behavior implementation.

 

precheck

A method is called before the update request to prevent unwanted changes from reaching the application buffer.

 

UPDATE in Behavior Projection

 

To make standard operation update available in OData and SAP Fiori, it has to be reused in the behavior definition for the projection view (behavior projection).

 

To include standard operation update in the OData service, add statement use update; to the entity behavior body (curly brackets after statement define behavior for … ). To disable the operation, remove the statement or turn it into a comment.

 

As soon as standard operation Update is available in the OData service, the generated SAP Fiori elements app displays an Edit button on the Object page for the related RAP BO entity. By choosing this button, the user enters an edit mode for the data displayed on the page.

 

Static Field Control

Read-only Input Fields

 

The statement field is used in behavior definitions, to specify the characteristics of fields. The statement is always located between the curly brackets after the statement define behavior (the entity behavior body). Commas can be used to classify multiple fields in the same way.

 

For the read-only characteristic of fields, the following variants exists:

Field ( readonly )

 

Field ( readonly : update)

 

To include the field characteristics into the OData service, it is not necessary to add the field statements in the behavior projection. The related information is directly included into the OData Service. The SAP Fiori elements UI uses this information for UI hints, that is, depending on the operation, the fields will be displayed as editable or read-only.

Mandatory Input Fields

 

For the mandatory characteristic of fields, the following variants exists:

 

Field ( mandatory )