SAP CDS PARAMETER PASSING



Get Example source ABAP code based on a different SAP table
  


VERSION 5 IN
• => ABAP_CDS_SCALAR

ABAP_CDS_FDL - Parameter Passing in Scalar Functions

ABAP_SYNTAX
... ( pname1 => act1, pname2 => act2, ... ) ...

What does it do?
Passes the actual parameters act1, act2, ... to the input parameters pname1, pname2, ... of an SQL-based scalar function.
The following can be specified as actual parameters:
Literals (typed or untyped)
Parameters
Session variables
Fields of a data source
Built-in functions if they return a suitable data type
Arithmetic expressions
Aggregate functions
Cast expressions
Case distinctions
Another SQL-based scalar function
A reuse expression using $projection.fieldName ABAP_NOTE Reuse expressions defined with $projection lose their reference information. $projection fields do not inherit annotations, so the references to currency keys or unit keys are lost.
A path expression
The data types of the actual parameters must exactly match the typing of the input parameters. The reference type specification WITH REFERENCE TYPE, if any, must be followed. Otherwise, a syntax check error occurs.
If an input parameter requires one of the reference types #CUKY , #UNIT, or #CALC, fewer operands are possible for the actual parameters because not all operands can provide the required reference information. The possible operands are:
Fields of a data source that are annotated with the required reference information.
Scalar functions that return a value of a suitable data type and that are annotated with the required reference information.
Path expressions that are annotated with the required reference information.
$projection fields that derive their reference information from the data source. ABAP_NOTE Reuse expressions defined with $projection use their reference information, if it is specified locally. However, if a reference type can be derived from the underlying data source, the reference information is preserved and a $projection field can be specified as an input parameter.

ABAP_EXAMPLE_VX5
The following CDS view entity passes a field of a data source, a typed literal and an input parameter as actual parameters to the input parameters of the CDS scalar function DEMO_CDS_SCALAR_REF_CASE.
DDLS DEMO_CDS_SCALAR_USE_REF_CASE
ABAP_EXAMPLE_END