Skip to content

ABAP Keyword Documentation →  ABAP − Reference →  Processing External Data →  ABAP Database Access →  ABAP SQL →  ABAP SQL - Operands and Expressions 

ABAP SQL - SQL parameter passing sql_para

Other versions: 7.31 | 7.40 | 7.54

Syntax


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

Effect

Specifies actual parameters act1, act2, ... for input parameters pname1, pname2, ... of a CDS entity in a parenthesized comma-separated list. Parameters can be passed to non-abstract CDS entities in the following positions in ABAP SQL statements:

If a CDS entity has input parameters as the data source data_source of a query or target of a CDS association specified in a path expression, a matching actual parameter must be passed to each input parameter as follows:

  • If an input parameter does not have an annotation @Environment.systemField, an explicit actual parameter must be specified.
  • If an input parameter has an annotation @Environment.systemField with one of the predefined values #SYSTEM_..., an explicit actual parameter does not need to be specified. If no actual parameter is specified, ABAP SQL passes the nominal value of the system field assigned using the annotation implicitly. Here, only the date and time are taken from the system fields sy-datum and sy-uzeit and the language and user name are taken from secure sources.
  • If an input parameter has an annotation @Environment.systemField with the predefined value #CLIENT, an explicit actual parameter must not be specified. Instead, ABAP SQL passes the ID of the current client or a client specified using USING CLIENT implicitly.

Literals, host variables, or host expressions can be specified as actual parameters. The name of a host variable must be prefixed with the escape character @. The data type of the parameter must be convertible into the built-in data type in ABAP Dictionary; the built-in data type is specified by the typing of the parameter. The content of the actual parameter must match the data type of the input parameter in accordance with the rules for a lossless assignment.

In the following cases, the parentheses ( ) after the name of a CDS entity can be empty or omitted:

Parentheses cannot be specified in CDS views without input parameters or in any classic dictionary objects.


Notes

  • There are currently no optional input parameters for CDS entities and no real replacement values for input parameters. The annotation @Environment.systemField bypasses this gap for some environment values by providing the caller with the non-optional parameters implicitly.

Example

Passes a time zone to the input parameter tz of the CDS view demo_cds_assoc_sairport_tz.

DATA timezone TYPE s_tzone VALUE 'UTC+1'. 
cl_demo_input=>request( CHANGING field = timezone ). 

SELECT id 
       FROM demo_cds_assoc_sairport_tz( tz = @timezone ) 
       INTO TABLE @DATA(result). 

cl_demo_output=>display( result ).

Executable Example

SELECT, CDS View with Input Parameters

Continue

ABAP SQL, Parameter Passing to a CDS View