ABAP Keyword Documentation → ABAP Dictionary → ABAP CDS in ABAP Dictionary → ABAP CDS - Views → ABAP CDS - DDL Statements → ABAP CDS - DEFINE VIEW → ABAP CDS - DEFINE VIEW, parameter_list
ABAP CDS - DEFINE VIEW, parameter_type
Other versions:
7.31 | 7.40 | 7.54
Syntax
... dtype | data_element ...
Effect
Types input parameters in the parameter list parameter_list. The type of a parameter can be specified either directly with dtype (using a predefined data type) or using the name of a data element data_element. The table below shows the possible specifications for dtype and their meanings.
dtype | Predefined data type in ABAP Dictionary |
---|---|
abap.char( len ) | CHAR with length len |
abap.clnt[(3)] | CLNT |
abap.cuky( len ) | CHAR with length len |
abap.curr(len,dec) | DEC with length len and with dec decimal places |
abap.dats[(8)] | DATS |
abap.dec(len,dec) | DEC with length len and with dec decimal places |
abap.fltp[(16,16)] | FLTP |
abap.int1[(3)] | INT1 |
abap.int2[(5)] | INT2 |
abap.int4[(10)] | INT4 |
abap.lang[(1)] | LANG |
abap.numc( len ) | NUMC with length len |
abap.quan(len,dec) | DEC with length len and with dec decimal places |
abap.tims[(6)] | TIMS |
abap.unit( len ) | CHAR with length len |
With len and dec, specific values must be specified for the length and decimal places (with regard to the relevant generic types).The values specified here in parentheses must be within the value ranges permitted by ABAP Dictionary. The predefined values can be specified for types with fixed lengths and decimal places, but this is not mandatory. For data_element, every ABAP Dictionary data element, whose predefined type is listed in the table above, can be specified.
Example
The following CDS view has two input parameters. p_date is typed with the data element DEMODATE and p_num is typed with the predefined data type DEC with both the length and number of decimal places specified.
define view demo_cds_parameter_type
with parameters p_date:demodate,
p_num:abap.dec(10,3) as
select from demo_expressions
{ key id,
:p_date as col_date,
:p_num + dec3 as col_num
};
The program DEMO_CDS_PARAMETER_TYPE accesses the view using the following SELECT
statement:
FROM demo_cds_parameter_type( p_date = @sy-datlo,
p_num = '1.234' )
INTO TABLE @DATA(result).