SAP ABAP SQL PARAMETERS



Get Example source ABAP code based on a different SAP table
  


• ( ) SELECT parameters

AB_SQL - SQL Parameter Passing sql_para

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

What does it do?
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 AB-SQL statements:
After a CDS entity as the data source of the FROM clause of a query.
After the CDS associations of a path expression in the data source of the FROM clause and in the specified columns of a query.
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, AB_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, AB_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 to the built-in data type in the 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. Only typed literals are passed directly without conversion.
In the following cases, the parentheses ( ) after the name of a CDS entity can be empty or omitted:
The function is a CDS table function without input parameters.
The view is a CDS view with input parameters that are all filled implicitly using the annotation @Environment.systemField .
Parentheses cannot be specified in CDS views without input parameters or in any dictionary objects.



Latest 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.
NON_V5_HINTS
Currently, a path expression in a specified column in a query cannot contain any CDS associations for entities with input parameters.
When parameters are passed to an entity with parameters, the syntax check is performed in ABAP_STRICT_740_SP08 strict mode from 7.40 SP08 / . If a host expression is specified as an actual parameter, the syntax check is performed in ABAP_STRICT_760 strict mode from ABAP_RELEASE ABAP_760 / . If a path expression is used at the same time or if a parameter is passed in a path expression, the syntax check is performed in ABAP_STRICT_767 strict mode from ABAP_RELEASE ABAP_767 / .
ABAP_HINT_END

ABAP_EXAMPLE_VX5
Passing of a time zone to the input parameter tz of the CDS view entity demo_cds_assoc_sairport_tz.
ABEXA 01200
ABAP_EXAMPLE_END

ABAP_EXAMPLE_ABEXA
SELECT, CDS View Entity with Input Parameters
ABAP_EXAMPLE_END