SAP NetWeaver AS ABAP Release 751, ©Copyright 2017 SAP AG. All rights reserved.
ABAP - Keyword Documentation → ABAP - Dictionary → ABAP CDS in ABAP Dictionary →ABAP CDS Metadata Extensions
A CDS metadata extension (MDE) extends a CDS entity with CDS annotations that are not defined in the CDS 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 CDS source code. This CDS source code can only be edited in the ABAP Development Tools (ADT). 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.
There is a dedicated set of CDS-DDL statements for defining metadata extensions in CDS source code, next to the CDS-DDL statements for data definitions. 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 source code of the CDS entity.
There can be several 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:
Notes
Caution
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.
CDS Metadata Extensions with CDS Variants