Application Development Blog Posts
Learn and share on deeper, cross technology development topics such as integration and connectivity, automation, cloud extensibility, developing at scale, and security.
Showing results for 
Search instead for 
Did you mean: 
Product and Topic Expert
Product and Topic Expert

CDS simple types provide a modern way to create user-defined elementary data types directly in ABAP CDS. Other than classical DDIC data elements, CDS simple types allow the creation of type hierarchies and attaching domain-specific semantics via CDS annotations. Read this blog post for more details.

Release info:

    • 2302 SAP BTP ABAP Environment
    • ABAP Release 7.58
    • SAP S/4HANA 2023

Comparison: Data elements and simple types

Here are the differences between DDIC data elements and CDS simple types:

PropertyDDIC data elementsCDS simple types
AvailabilityFor typing in DDIC, CDS, and ABAPFor typing in CDS and in ABAP.
Reuse capabilitiesReusable data types for typing in ABAP and in ABAP CDS.Reusable data types for typing in ABAP and CDS that can be nested with each other.
MetadataTechnical settings in SE11.CDS annotations for domain-specific metadata
DefinitionForm-based editor and DDIC DDL. Design time.Syntax-based definition in ADT. Desgin time.
Framework supportSupported by technologies such as WebDynpro and SAP GUI.Supported by frameworks such as RAP and the ABAP Analytical Engine.

Defining a CDS simple type

Defining a CDS simple type is really easy.
In ADT, a simple type is created as a repository object of type Type. 

You can specify some annotations and then all you have to do is give it a name and a type after the statement DEFINE TYPE.


 DEFINE TYPE simple_type : typing


Here's an example:


@EndUserText.label: ‘This is a CDS simple type’
DEFINE TYPE myType : abap.int4;


Typing of a CDS simple type

A CDS simple type can be typed using a DDIC data element, a built-in data type, or using another simple type.

Typing with a DDIC data element

When a CDS simple type is typed with a DDIC data element, the technical and semantic properties of the data element are inherited by the CDS simple type and translated into annotation values. The following table shows the mapping of DDIC properties to simple types:

DDIC propertyCDS simple type annotation
Conversion routing@AbapCatalog.typeSpec.conversionExit
Lowercase letters@ObjectModel.upperCase
Flag for change document@AbapCatalog.typeSpec.changeDocumentRelevant
Field label, Heading@EndUserText.heading
Field label, Medium@EndUserText.label
Short Text@EndUserText.quickInfo

Here's an example of inheritance from a data element to a CDS simple type. The simple type DEMO_SIMPLE_TYPE_INHERITANCE is typed using a DDIC data element.


define type demo_simple_type_inheritance: demo_bt_inheritance;


The Active Annotations View in ADT shows that all annotations derived from the underlying data element and from the DDIC domain are translated into annotation values:

Active Annotations View

  Typing using a built-in data type

A CDS simple type can be typed using a built-in data type. Almost all built-in data types from ABAP Dictionary are possible. Here's an example:


@EndUserText.heading: 'abc' 

@EndUserText.label: 'myLabel' 

@EndUserText.quickInfo: 'lala'  

define type demo_simple_type : abap.int4; 


Typing with another simple type

A CDS simple type can be typed with another simple type. Annotations are inherited, but it is also possible to overwrite the inherited annotation values.
Here's an example:
First layer simple type:


@EndUserText.heading: 'abc'

@EndUserText.label: 'myLabel'

@EndUserText.quickInfo: 'lala' 

define type demo_simple_type : abap.int4;


Second simple type that is based on the first simple type:




Using a CDS simple type

A CDS simple type can be used in ABAP CDS for typing of elements and parameters and for casting. In ABAP, CDS simple types can be used for type declarations after the TYPE statement. Here are some examples:

Using a CDS simple type in a CDS view entity

The following CDS view entity uses a CDS simple type in a cast expression and for typing the input parameter p1.


@EndUserText.label: 'CDS view entity, simple types' 
define view entity DEMO_CDS_SIMPLE_TYPE_USAGE 
  with parameters 
    p1 : demo_simple_type
  as select from demo_expressions 
  key id                                   as Id, 
      num1                                 as Num1, 
      $parameters.p1                       as Parameter1, 
      cast( char2 as demo_simple_type_de ) as cast_bt 


Using a CDS simple type in an ABAP program

Simple types can be used for typing in ABAP programs after the TYPES statement in the same way as DDIC data elements. Here's an example:


DATA MyType TYPE demo_simple_type.
MyType = 1.



    • ABAP Cloud is a new development model that aims at modernizing and simplifying the ABAP programming language. It takes place entirely in ADT and relies on ABAP CDS for the data modeling layer. Therefore, there is a lot of investment in ABAP CDS features to provide maximum ease of use.
    • CDS simple types are another step in the modernization of the ABAP language. ABAP Dictionary is receding into the background, while users are encouraged to use ABAP CDS.
    • Another CDS-native data type will be made available soon: The CDS enumerated type to define globally available enumerated types. Be prepared!

Further information

Labels in this area