ABAP Addition 1 ... GROUP BY field1, field2, ...> 2 ... EXCEPT>$|INTERSECT>$|UNION $[ALL$] { ... }>
What does it do? Extends an existing CDS view entity> cds_view_entity> or an existing CDS projection view > projection_view> using a CDS view entity extension> in the CDS DDL>. An existing CDS view can have one or more CDS view entity extensions.
ABAP_PREREQUISITE As a prerequisite for the extension of the CDS entity with the statement EXTEND VIEW ENTITY>, the elements of the annotation array> AbapCatalog.viewEnhancementCategory[ ]>> must be specified accordingly in its definition with DEFINE VIEW ENTITY>>:
By default or if only the value #PROJECTION_LIST> is specified, views without aggregate expressions > in the SELECT> list and without a set-operator> clause can be extended.
In order to extend views that have aggregate expressions> in the SELECT> list, the annotation array must contain the value #GROUP_BY> alongside #PROJECTION_LIST>.
In order to extend views that contain set-operator clauses, the annotation array must contain the value #UNION > alongside #PROJECTION_LIST>. ABAP_NOTE The annotation array value #UNION> allows extensions not only for union views, but for views including any set operator (also EXCEPT>> and INTERSECT>>). The annotation array value #UNION> is a known misnomer.
If the annotation array contains the value #NONE>, the view cannot be extended. Additionally, the annotation AbapCatalog.extensibility.extensible>> must not be set to false>. ABAP_PREREQ_END
Components of a View Entity Extension View entity extensions can make additions to the original view, but they cannot modify, overwrite, or delete elements from the original view. The following components are possible in a CDS view entity extension:
New associations association1>, association2> can be defined and exposed in the CDS view entity extension. The same rules apply that are described in topic CDS DDL - CDS view entity, ASSOCIATION>>. ABAP_NOTE It is not> allowed to define new CDS to-parent associations> in a view 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.
When extending a CDS projection view, the view entity extension can specify all features that are possible in a projection view, such as CDS virtual elements>, localized elements>, and redefined> and redirected associations>. See topic TITLE > for a complete list.
When extending a CDS view entity, the view entity extension can specify all features that are possible in a view entity, such as path expressions>, elementary operands>, expressions> and functions>. See topic TITLE > for a complete list.