Get Example source ABAP code based on a different SAP table
• EXTEND ABSTRACT ENTITY ABAP_CDS_DDL_STATEMENT • WITH ABAP_CDS_EXT_ABS_ENT
ABAP_CDS_DDL - EXTEND ABSTRACT ENTITY>
ABAP_SYNTAX EXTEND ABSTRACT ENTITY cds_abstract_entity WITH { element_list_extension }>
What does it do? Extends an existing CDS abstract entity > cds_abstract_entity> using a CDS abstract entity extension> in the CDS DDL>. An existing CDS abstract entity can have one or more CDS abstract entity extensions.
ABAP_PREREQUISITE As a prerequisite for the extension of the CDS abstract entity with the statement EXTEND ABSTRACT ENTITY>, the base entity must allow extensions. Extensions are allowed per default or can be explicitly allowed with the annotation AbapCatalog.extensibility.extensible>> with the value true >. If the value false> is specified, extensions are not allowed. ABAP_PREREQ_END
Components of an Abstract Entity Extension Abstract entity extensions can make additions to the original entity, but they cannot modify, overwrite, or delete elements from the original entity. An abstract entity extension can specify only features that are possible within abstract entities, but with some limitations. The following can be specified in an abstract entity extension:
New elements. These new elements are defined as described in topic DEFINE ABSTRACT ENTITY>, element >. Those elements can have element annotations>. New key elements are not possible.
New associations _assoc1>, _assoc2> can be defined in the CDS abstract entity extension. The same rules apply that are described in topic DEFINE ABSTRACT ENTITY >, association>. ABAP_NOTE It is not> allowed to define new CDS to-parent associations> in an abstract entity extension. New CDS composition> associations are allowed under the condition that the composition target is also defined as composition child and has the required to-parent association. The composition target is the extended abstract entity, not the extension itself.
Each appended element must have a unique name.
ABAP_RESTRICTIONS
CDS abstract entity extensions themselves cannot be extended.
It is not possible to specify new input parameters> in an abstract entity extension.
No addition ROOT> can be specified in the statement EXTEND ABSTRACT ENTITY> to transform a regular entity to a root entity>.
An appended element cannot be defined as a KEY> element.
In an abstract entity extension, header annotations> are not supported. That means that no annotations are allowed in front of the statement EXTEND ABSTRACT ENTITY>. ABAP_RESTR_END VX_EXA_ONLY
ABAP_EXAMPLE_VX The following CDS abstract entity extension DDLS DEMO_CDS_ABSTRACT_EXTEND adds a new element and a new association to the existing CDS abstract entity. DDLS DEMO_CDS_ORIGINAL_ABSTRACT The class CL_DEMO_CDS_ABSTRACT_EXTEND> > evaluates the structure of the extended CDS abstract entity using RTTI> methods. ABAP_EXAMPLE_END