ABAP - Keyword Documentation →  ABAP - Dictionary →  ABAP CDS in ABAP Dictionary →  ABAP CDS - Annotations →  ABAP CDS - Specifying Annotations → 

ABAP CDS Metadata Extensions

A CDS metadata extension (MDE) extends a CDS entity with CDS annotations that are not specified in the DDL source code of the data definition. CDS metadata extensions can currently only be created for CDS views.

A CDS metadata extension is a CDS object that is defined and transported in a separate piece of DDLX source code. These pieces of DDLX source code can only be edited in the ABAP Development Tools (ADT). DDLX source code can also be displayed in Repository Browser in ABAP Workbench. Once a CDS metadata extension has been activated for a CDS entity, the methods of the class CL_DD_DDL_ANNOTATION_SERVICE take the annotations of the associated metadata extensions into account by default when evaluating the annotations of this entity.

Alongside the CDS DDL statements for data definitions, there is a CDS DDL statement for defining metadata extensions in DDLX source code. A prerequisite for extending a CDS entity with metadata extensions is that the annotation Metadata.allowExtensions (with the default value true) is specified in the DDL source code of the CDS entity.

There can be multiple metadata extensions for one CDS entity. The following rules determine which metadata extension to use to evaluate the annotations:

In an evaluation with the class CL_DD_DDL_ANNOTATION_SERVICE, the metadata extensions of the specified variant are searched for annotations first, and then the metadata extensions without a join to a variant. In each case, the priority is determined by the layers of the metadata extensions. Next, the direct and indirect annotations of the CDS entity itself are added that do not have an entry in a metadata extension.

For more information, see the following:



CDS variants are not currently released for general use. It is not possible to define standalone CDS variants and the use of CDS variants in metadata extensions produces a syntax check warning.

ABAP CDS - DDL for Metadata Extensions
ABAP CDS - Evaluation of Metadata Extensions
Example CDS Metadata Extensions with CDS Variants