Get Example source ABAP code based on a different SAP table
ABAP_CDS - Metadata Extensions A CDS metadata extension> (MDE) adds CDS annotations> to a CDS entity> that are not specified in the DDL source code> of the data definition>. Currently CDS metadata extensions can be created for ABAP_CDS_V2_VIEWS >, CDS projection views>, ABAP_CDS_V1_VIEWS >, and CDS abstract entities >. 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)>. BEGIN_SECTION VERSION 5 OUT DDLX source code can also be displayed in Repository Browser> in ABAP Workbench>. END_SECTION VERSION 5 OUT 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. A CDS entity can have more than one CDS metadata extension. The following rules determine which metadata extension to use to evaluate the annotations>:
Each metadata extension is assigned to a layer, such as branch, partner, or customer. The layer determines the priority of the evaluation. In an evaluation with the class CL_DD_DDL_ANNOTATION_SERVICE>, 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:
DDL for Metadata Extensions>
Evaluation of Metadata Extensions >
Latest notes:
The DDL source code> and the activation of a CDS entity are completely independent of any metadata extensions for this entity. For this reason, a metadata extension can only add annotations that are not already evaluated during the activation of the CDS entity.
Metadata extensions separate the way metadata is specified from the actual data definition. Specifying the annotations that are not required to activate a CDS entity outside the DDL source code of the CDS entity has the following advantages:
It greatly improves the readability of the DDL source code of a data definition if it does not have to list all the metadata.
The metadata can be specified and transported independently of the data definition.
Separating the activation of metadata from the data definition avoids the need for mass activation of dependent repository objects that can occur when activating a data definition.
When using metadata extensions for framework-specific annotations>, note the relevant rules. Otherwise error messages can occur during framework-specific checks.
Layers allow frameworks, partners, and customers to override the metadata of a CDS entity without making modifications.
Metadata extensions can be connected to the Switch Framework>, making them switchable.
The program ABAP_DOCU_MDE_ANNOS>> shows all annotations that can be specified in metadata extensions. NON_V5_HINTS
Metadata extensions support the separation of concerns (SoC)> concept. ABAP_HINT_END