Ansicht
Dokumentation

ABENBDL_NONSTANDARD_PROJECTION - BDL NONSTANDARD PROJECTION

ABENBDL_NONSTANDARD_PROJECTION - BDL NONSTANDARD PROJECTION

Addresses (Business Address Services)   ABAP Short Reference  
This documentation is copyright by SAP AG.
SAP E-Book

- Actions and Functions, Projection BDEF

New action definition

$[internal$]$[static$]$[factory$]$[${static factory$}$] action
                  $[(
                  $[ features: ${instance $| global$}$]
                  $[precheck$]
                  $[ authorization:none$]
                  $[ authorization:update$]
                  $[lock:none$]
                   )$]
                   ActionName $[ external 'ExternalName'$]
                  $[InputParameter$]
                  $[ OutputParameter$]


New function definition

$[internal$] $[static$] function FunctionName
                   $[external 'ExternalName'$]
                   $[InputParameter$]
                    OutputParameter


Effect

You can specify new actions and functions for a projection BO in the projection layer. This works similar to defining actions and functions in a base BDEF; see topics CDS BDL - action and CDS BDL - function.

There is a difference however regarding the authorization concept of an action defined in a projection BDEF: In a projection BDEF, no authorization master from the base BDEF is available. If an authorization concept is required, this must be specified for each node of a BO node as described in topic CDS BDL - authorization, projection BDEF.

  • Development guide for the ABAP RESTful Application Programming Model, topic Action Definition.
  • Development guide for the ABAP RESTful Application Programming Model, topic Function Definition.

Example - Defining an Action in the Projection Layer

The following example shows a projection BDEF that defines a new action in the projection layer. It is based on the underlying base BO DEMO_RAP_UNMANAGED_AUTH. It defines the new action deductDicounts in the projection layer. For this action, global authorization control is specified.

The ABAP behavior pool implements the global authorization control and the new action.

Global authorization control: In this simple example, the condition for global authorization control is always true.

Action deductDiscount: The user can specify a discount percentage. This discount percentage is subtracted from the initial value of field dec_field.

The ABAP program DEMO_RAP_PROJ_NEW_ACTION uses EML to access to RAP business object. It first creates two new entity instances and then executes the action deductDiscount for both of them.

Result: The specified discount percentage is subtracted from the initial value.

IMAGE @@ABDOC_NEW_ACTION.jpg@@243@@371@@

Example - Defining a Function in the Projection Layer

The following example shows a projection BDEF that defines a new function in the projection layer. It is based on the underlying base BO DEMO_RAP_STRICT. It defines the new function getDetails in the projection layer.

The ABAP behavior pool implements the new function getDetails. This function reads the values of the fields key_field and data_field and returns them in its result structure.

The ABAP program DEMO_RAP_PROJ_NEW_FUNCTION uses EML to access to RAP business object. It first creates two new entity instances and then executes the function getDetails for both of them.

Result: The content of the fields key_field and data_field is returned in the result structure.

IMAGE @@ABDOC_NEW_FUNCTION.jpg@@351@@110@@




BAL Application Log Documentation   SUBST_MERGE_LIST - merge external lists to one complete list with #if... logic for R3up  
This documentation is copyright by SAP AG.

Length: 7788 Date: 20240426 Time: 182336     sap01-206 ( 98 ms )