Ansicht
Dokumentation

ABENBDL_ACTION_INPUT_PARAM - BDL ACTION INPUT PARAM

ABENBDL_ACTION_INPUT_PARAM - BDL ACTION INPUT PARAM

BAL_S_LOG - Application Log: Log header data   TXBHW - Original Tax Base Amount in Local Currency  
This documentation is copyright by SAP AG.
SAP E-Book

- InputParameter

Flat parameter

... parameter ${ ParameterEntity $| $self $};

Deep parameter

... $[deep $[table$]$] parameter AbstractBDEF;

Alternatives:

1. ... parameter ${ ParameterEntity $| $self $};

2. ... $[deep $[table$]$] parameter AbstractBDEF;

Effect

Defines an input parameter for an action or function. The input parameter can be flat or deep.

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

Example

The following example shows a managed BDEF based on the CDS root view entity DEMO_CDS_ACTION_INPUT_PARAM. The business object describes a purchase order item. The BDEF defines one action, deductDiscount. This action has an input parameter for the discount percentage and it calculates the price of an item minus the discount. It is implemented in the behavior pool BP_DEMO_CDS_ACTION_INPUT_PARAM.

The program DEMO_CDS_ACTION_REDUCE accesses the business object using EML and carries out the following operations:

  • It asks the user to specify the discount in percent.
  • It creates two instances of a purchase order item, identified by the key PurchaseDocumentItem, and assigns a price Price to each.
  • It executes the action deductDiscount.
  • Using the SELECT statement, the content of the underlying database table is displayed.

Result: the price is reduced by the specified discount - here, the discount was specified as 10 percent.

IMAGE @@ABDOC_ACTION_DISCOUNT.png@@389@@253@@

The example above is explained in detail in the executable example CDS BDL - action with input parameter.

Alternative 1

parameter ${ ParameterEntity $| $self $}


Effect

  • $self can be specified if the input parameter entity is the same abstract entity the action or function is assigned to.
  • Input parameters with $self are only allowed on static actions or functions. When specified for instance actions or functions, there is no syntax check warning, and a runtime error occurs instead when a RAP BO consumer accesses the action or function in question.

Notes

  • If a CDS abstract entity is specified as input parameter, the annotation EndUserText.label can be used to define a label that is displayed on the user interface in an OData scenario.

Alternative 2

$[deep $[table$]$] parameter AbstractBDEF


Effect

The input parameter AbstractBDEF must be a CDS abstract BDEF with hierarchy. The BDEF derived type for an abstract BDEF is a hierarchy that contains all entity fields plus a component for every composition.

The following syntax options are available:

  • deep parameter AbstractBDEF: The input parameter is interpreted as structure.
  • deep table parameter AbstractBDEF: The input parameter is interpreted table.

Note

An abstract BDEF can also be used as input parameter only with the keyword parameter. In this case, it is interpreted as flat parameter. It represents the same derived type as a single CDS abstract entity and doesn't offer any additional value.






Fill RESBD Structure from EBP Component Structure   PERFORM Short Reference  
This documentation is copyright by SAP AG.

Length: 6997 Date: 20240420 Time: 023058     sap01-206 ( 58 ms )