What does it do? Determine actions> allow the RAP BO consumer> to execute determinations> and validations> on request. Whenever a determine action is executed, the determinations and validations assigned to it are evaluated and then only those determinations and validations are executed whose trigger conditions are fulfilled. A determine action can include determinations defined as on save> and validations. Determinations defined as on modify> are not allowed. If the optional addition always> is used, then all determinations and validations that are part of the determine action are executed regardless of their trigger conditions. After a determination with the flag always> has been executed, it can be triggered again by other determinations belonging to the same determine action. Determinations and validations of child entities> can be included using the syntax child~childDetermination> or child~childValidation >, as long as these validations and determinations do not include the trigger operation delete>. Execution order: Determinations are executed first, validations afterwards. The execution order among determinations or validations themselves is defined by the RAP framework > and is independent of the specified order within the determine action. The following RAP BDL operation additions > are possible:
internal>> to make the respective determine action accessible only from within the business object implementation.
authorization:none>> excludes the operation in question from authorization checks>.
authorization:update>> delegates the authorization control> to the authorization check that is implemented for the update operation. The optional addition extensible > is only available for draft-enabled BOs >. It allows a RAP BO consumer to add own validations or determinations to the determine action in question via a BDEF extension>. For further details on extensibility enabling, see topic TITLE >.
ABAP_AVAILABILITY
Managed RAP BOs>
Unmanaged> and draft-enabled> RAP BOs. ABAP_CAUTION Not available for unmanaged, non-draft RAP BOs.
Projection BOs> ABAP_AVAILABILITY_END In a managed RAP BO>, determine actions do not require an implementation in the ABAP behavior pool (ABP)>, but the determinations and validations included in a determine action must be implemented. In an unmanaged RAP BO >, determine actions require an implementation in the RAP handler method> FOR MODIFY> > in the ABAP behavior pool. In a projection BDEF>, determine actions from the base BDEF can be reused. For details on reuse, see topic TITLE >. It is not possible to specify new determine actions in a projection BDEF.
ABAP_FURTHER_INFO Development guide for the ABAP RESTful Application Programming Model, topic Action Definition>.
Latest notes: The draft determine action> Prepare> is the draft pendant to determine actions. It is documented in topic RAP BDL - draft actions>. NON_V5_HINTS ABAP_HINT_END
ABAP_EXAMPLE_VX5 The following example shows a managed BDEF based on the on the CDS root view entity DEMO_SALES_CDS_SO_3>>. The root view entity represents a sales order and the child entity represents a sales order item. The determine action trigger_all> includes the following two determinations, one from in the root entity and one from the child entity:
setID> assigns values to the semantic key field SalesOrderId > during the save sequence> whenever a new entity instance is created.
TotalPrice> sums up the price of all items of a sales order. It is triggered whenever a new sales order is created. BDEF DEMO_SALES_CDS_SO_3 The determinations are implemented in the behavior pool BP_DEMO_SALES_CDS_SO_3>>. The class CL_DEMO_CDS_DETERMINE_ACTION>> accesses the business object using EML> and carries out the following steps:
It first inserts data into the BO's persistent database tables> using AB_SQL >. That means that BO entity instances are available in the database, but the determinations haven't yet been triggered.
The determine action trigger_all> is executed with the statement MODIFY ENTITIES> for two entity instances. For these two entity instances, the fields ID> and TotalPrice> are determined. Code snippet: ABEXA 01533
The determined values are committed to the database with the statement COMMIT ENTITIES>. Result: values for the fields ID> and TotalPrice> are determined. IMAGE ABDOC_DET_ACTION.png 503 263 ABAP_EXAMPLE_END