Skip to content

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

ABAP CDS - DEFINE ABSTRACT ENTITY

Other versions: 7.31 | 7.40 | 7.54

Syntax


[@entity_annot1] 
[@entity_annot2]
...
[DEFINE] ABSTRACT ENTITY cds_entity
         [parameter_list]
          element_list[;]

Effect

Defines an abstract CDS entity cds_entity in CDS DDL. When an abstract CDS entity is activated, its metadata is created but no other object instances are created on the database or in AS ABAP. The name cds_entity must comply with the naming conventions for dictionary types and can have a maximum of 30 characters.

  • parameter_list is used to declare a list of optional input parameters for the abstract CDS entity.
  • element_list is used to declare elements and CDS associations of the abstract CDS entity.

An abstract CDS entity can be used as a global structured type in ABAP programs. The entity is located in the namespace of the data types in ABAP Dictionary and in the namespace of the global object types in the class library. The elements of the abstract CDS entity define the components of the global structured type that can be referenced in ABAP programs using TYPE. As is the case for any CDS entity, the annotations of an abstract CDS entity can be evaluated.


Notes

  • An abstract CDS entity cannot be used as a data source in other CDS entities or in ABAP SQL.

  • The DDL source code of an abstract CDS entity must have the same name as this entity.

  • No classic ABAP Dictionary structure visible in the tools for classic structures is created for an abstract CDS entity.

Example

The following DDL source code shows an abstract CDS entity:

@EndUserText.label: 'Abstract CDS Entity'
@DemoAnno.vAnnot1:  'Some annotation'
define abstract entity demo_cds_abstract_entity
  {
    key col1 : abap.char(3);
        col2 : abap.int4;
        col3 : abap.string;
        col4 : demo_char_text;
  }

The program DEMO_CDS_ABSTRACT_ENTITY demonstrates the following:

  • The structure of the abstract CDS entity can be evaluated using RTTI methods.
  • The annotations of the abstract CDS entity can be evaluated using the class CL_DD_DDL_ANNOTATION_SERVICE.
  • The structure of the abstract CDS entity can be used as a data type in the ABAP program.

Continue

ABAP CDS - DEFINE ABSTRACT ENTITY, parameter_list

ABAP CDS - DEFINE ABSTRACT ENTITY, element_list