ABAP Keyword Documentation → ABAP - Dictionary → ABAP CDS in ABAP Dictionary → ABAP CDS - Data Definitions → ABAP CDS - DDL for Data Definitions → ABAP CDS - DEFINE VIEW
ABAP CDS - DEFINE VIEW, parameter_list
Other versions:
7.31 | 7.40 | 7.54
Syntax
... WITH PARAMETERS parameter1, parameter2, ...
Effect
Defines CDS parameters parameter1, parameter2, ... as input parameters of a CDS view in a comma-separated list.
An input parameter called pname can be used as an operand in the following places in the SELECT statement of the view using the syntax :pname or $parameters.pname:
- Element in the SELECT list
- Operand of an arithmetic expression
- Operand operand directly after case in a case distinction
- Right side of an expression cond_exp in a WHERE clause or HAVING clause
- Right side of an expression cond_exp in an ON condition in an ABAP join or a CDS association
- Right side of an expression cond_exp in a filter condition of a path expression
- Right side of an expression cond_exp in the default filter condition of a CDS association
Example
The following CDS view has a list of three input parameters used in the
WHERE clause of the SELECT statement.
For information about passing actual parameters in a SELECT
statement in
ABAP, see the executable example SELECT
, CDS View with Input Parameters.
@AccessControl.authorizationCheck: #NOT_REQUIRED
@Metadata.allowExtensions
@EndUserText.label: 'Demo für Parameter-View'
define view demo_cds_parameters
with parameters
p_distance_l :s_distance,
p_distance_u :s_distance,
p_unit :s_distid
as select from
spfli
{
key carrid,
key connid,
cityfrom,
cityto,
distance,
distid
}
where
distid = :p_unit
and distance between :p_distance_l and :p_distance_u;