ABAP - Keyword Documentation →  ABAP - Dictionary →  ABAP CDS in ABAP Dictionary →  ABAP CDS - Data Definitions →  ABAP CDS - DDL Statements → 

ABAP CDS - typing


... dtype | data_element  ...


Types elements or parameters of CDS entities in ABAP CDS. The following is typed:

A typing can be specified either directly with dtype (using a predefined data type in ABAP Dictionary) or using the name of a data element data_element. The table below shows the possible options 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(5) CUKY with length 5
abap.curr(len,dec) CURR 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.int8[(19)] INT8
abap.lang[(1)] LANG
abap.numc( len ) NUMC with length len
abap.quan(len,dec) QUAN with length len and with dec decimal places
abap.raw(len) RAW with length len
abap.sstring(len) SSTRING with length len
abap.tims[(6)] TIMS
abap.unit(3) UNIT with length 3

In len and dec, specific values must be specified for the length and decimal places (with respect 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.


Currently no structured or tabular parameters are supported, only elementary data types.


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.

@AbapCatalog.sqlViewName: 'DEMO_CDS_PTYPE'
@AccessControl.authorizationCheck: #NOT_REQUIRED
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:

SELECT id, col_date, col_num
       FROM demo_cds_parameter_type( p_date = @sy-datlo,
                                     p_num  = '1.234' )
       INTO TABLE @DATA(result).