Ansicht
Dokumentation

ABENCDS_COMPOSITION - CDS COMPOSITION

ABENCDS_COMPOSITION - CDS COMPOSITION

ROGBILLS - Synchronize billing plans   SUBST_MERGE_LIST - merge external lists to one complete list with #if... logic for R3up  
This documentation is copyright by SAP AG.
SAP E-Book

- SELECT, COMPOSITION

... COMPOSITION $[ [min..max] $] OF target $[AS _compos$] ...

Additions

1. ... $[min..max$]

2. ... AS _compos

Effect

Defines a CDS composition (or composition for short) with the name _compos in a SELECT statement of a CDS view. A CDS composition associates the current CDS entity, as a composition source, with the composition target target specified in the definition of the composition. Compositions are specialized CDS associations and are defined in CDS entities using the keyword COMPOSITION OF.

The node in which a composition is defined is a parent entity. The target of a composition target is a child entity. The child entity must already define a to-parent association before a CDS composition can be defined in the parent entity. A CDS composition does not have its own ON condition and it is applied implicitly from the to-parent association instead.

The composition target of the composition cannot be specified using a path expression and must be a CDS entity instead. If target is an CDS abstract entity, the way the composition can be used is restricted.

The following applies to the nodes of a composition:

  • The target of a composition target cannot be the CDS entity in which this composition is defined.
  • The target of a composition cannot be a root entity.
  • Unless it is a root entity, a parent entity can itself be the target of a composition.
  • A child entity can be the target of precisely one composition. This means that a child entity can have precisely one parent entity.
  • A child entity can itself be a parent entity and define further compositions.

The name of the composition _compos must be added precisely once to the select_list of the CDS it is defined in, without attributes and alias. If no name is defined for the composition, the name of the composition is the name of the target entity target and this name must be made available in the SELECT list.

A composition can be accessed as follows:

  • By specifying its name in a path expression in the same statement and in all places where this is documented. A CDS composition whose composition target is an CDS abstract entity can only be exposed in the SELECT list.
  • If a CDS composition whose composition target is not abstract is exposed by a path expression in the SELECT list of the current SELECT statement, other CDS views or ABAP SQL statement can use it in their path expressions.

The following applies to the compositions:

  • Compositions cannot be used locally in a SELECT list, WHERE clause, HAVING clause of the CDS view that defines them, or in EXTEND VIEW if this produces a join. This restriction is necessary to guarantee that the ON condition for the composition can always be generated from the ON condition of the to-parent association.
  • Compositions can be used in annotations (such as AnnotationRef or ElementRef) in the CDS entities that define them, since this does not produce a join.
  • Compositions can be passed in other data definitions by specifying the name of the composition in the SELECT list. In this case, the composition is propagated without the semantics of the composition definition. Compositions can be passed using an alias in the SELECT list and the same rules apply as to associations.
  • Like associations, compositions can be also be propagated in UNION views.
  • Compositions can be passed using a filter in the SELECT list. The same rules apply as to associations.

Notes

  • Cyclical dependencies should be avoided when using compositions to prevent problems occurring in mass activations of CDS entities.
  • No ON condition is defined explicitly for a composition. The ON condition is generated automatically using the ON condition of the to-parent association of the composition target.
  • Unlike in associations, no DEFAULT FILTER can be defined for a composition.
  • Compositions can be given annotations in the element list element_list of the CDS entity in which they are defined.

Addition 1

... $[min..max$]

Effect

This addition works in the same way as the addition association.

Addition 2

... AS _compos

Effect

This addition works in the same way as the addition association.






CPI1466 during Backup   ROGBILLS - Synchronize billing plans  
This documentation is copyright by SAP AG.

Length: 8949 Date: 20240426 Time: 191624     sap01-206 ( 120 ms )