Skip to Content
Technical Articles
Author's profile photo Andrea Schlotthauer

ABAP CDS Releases CDS-Native Data Types: CDS Simple Types

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

Comparison: Data elements and simple types

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

Property DDIC data elements CDS simple types
Availability For typing in DDIC, CDS, and ABAP For typing in CDS and in ABAP.
Reuse capabilities Reusable 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.
Metadata Technical settings in SE11. CDS annotations for domain-specific metadata
Definition Form-based editor and DDIC DDL. Design time. Syntax-based definition in ADT. Desgin time.
Framework support Supported 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.

  1. 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 property CDS 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

  2. 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; 

  3. 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:

  1. 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 

  2. 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

Assigned Tags

      You must be Logged on to comment or reply to a post.
      Author's profile photo Jelena Perfiljeva
      Jelena Perfiljeva

      Thanks for sharing!

      Not sure if I understood all that correctly (LOL, didn't read 🙂 ). So, is this, in a nutshell, pretty much like ABAP TYPES command but for CDS views and annotations are involved? Or am I missing something?

      Thank you!

      Author's profile photo Andrea Schlotthauer
      Andrea Schlotthauer
      Blog Post Author

      Hi Jelena,

      a CDS type defines a data type, similar to the TYPES command in ABAP. So far so good.

      But a CDS type is available globally, and it can be reused in different programs or CDS entities. It can be stacked and nested and therefore reused, and it can have annotations.

      You could also compare it to a DDIC data element with additional features....

      CDS types can be used in the CDS world and in ABAP programs, but not for typing in DDIC.

      Hope this helps 🙂


      Author's profile photo Denis Kollar
      Denis Kollar

      Thank you for writing about this.

      One thing I am thinking about is, where should you defines these CDS simple types. In basic, consumption or private views?

      If I have 4 CDS views where I would like to use one CDS defined type, in which should it be defined.

      Also if there are many types defined in one CDS, won't this CDS become significantly bigger in size over time?

      Author's profile photo Andrea Schlotthauer
      Andrea Schlotthauer
      Blog Post Author

      A CDS type is a standalone repository object. It is not defined as part of a view.

      In ADT, choose "New Type" to create a simple type. The syntax statement is DEFINE TYPE.

      You can then reuse this type in all of your views, basic, consumption, or private, wherever you need it.

      Imagine it like a DDIC data element. A central data type that can be used wherever needed.

      Hope this helps.