Ansicht
Dokumentation

ABENCDS_SELECT_LIST_ASSOCIATION_V2 - CDS SELECT LIST ASSOCIATION V2

ABENCDS_SELECT_LIST_ASSOCIATION_V2 - CDS SELECT LIST ASSOCIATION V2

Addresses (Business Address Services)   General Data in Customer Master  
This documentation is copyright by SAP AG.
SAP E-Book

- CDS View Entity, SELECT, expose_assoc

... path_expr $[AS alias$]

Effect

Uses a path expression path_expr to expose a CDS association as an element of the SELECT list of a CDS view entity. A path expression can consist of one or more associations, and the final CDS association is exposed for use in other CDS views or in :

  • A different CDS view can evaluate the CDS association in its path expressions.

The current view is the association source of the exposed CDS association and any join expression created for a path expression from the CDS association uses the current CDS view entity as its left side.

All fields of the association source that are used in the ON condition must also be specified as elements of the current SELECT list. Such an element must be specified by exactly the same path expression as used for exposing the association. It must contain the same associations in the same sequence and with the same attributes.

A CDS association can be exposed multiple times with various alternative element names alias defined using the keyword AS (see example below). This makes it possible to use different filter conditions cds_cond. However, this is only possible for simple CDS associations and not for compositions and to-parent associations.

An exposed CDS association is part of the SELECT list. It is not, however, part of the result set, nor a component of the type defined in ABAP with respect to the CDS view entity.

The names of the elements of a SELECT list must be unique. This applies in particular also for the publication of a CDS association using a path expression. There must be no other element with this name. If necessary, AS must be used to define an alternative element name alias for the CDS association. If no alternative element name alias is defined, the element name is defined by the name of the CDS association used in the path expression. When a CDS association with a filter condition cds_cond is exposed, an alternative element name alias using AS is mandatory.

Notes

  • When a CDS association is exposed, the exposing view itself is the association source of the exposed CDS association - not the data source of the exposing view. Especially when CDS associations are exposed that were already exposed by the data source of the current view, the current view replaces the original view as the association source. When a join expression is created for the current view, the left side of the join expression is the result set of the current view.
  • Special rules apply to the publication of CDS associations in SELECT statements joined with a set operator.

Example

The following CDS view entity exposes its own CDS association _spfli and the CDS association _sflight exposed by its association target demo_cds_assoc_spfli. The fields of the association source, which are used in the ON conditions of the CDS associations, are specified in the SELECT list. In the case of the CDS association exposed using _spfli._sflight, path expressions _spfli.carrid and _spfli.connid are specified accordingly. The element carrid occurs twice, therefore, an alternative element name must be defined using AS.

Example

The following CDS view entity exposes its own CDS association _spfli with a filter condition. The fields of the association source, which are used in the ON condition of the CDS association, are specified in the SELECT list using the same filter condition. Once this has been done, the same association can be exposed again with different filter conditions. New alias names are required.

Exposing CDS Associations






SUBST_MERGE_LIST - merge external lists to one complete list with #if... logic for R3up   BAL_S_LOG - Application Log: Log header data  
This documentation is copyright by SAP AG.

Length: 8390 Date: 20240426 Time: 042445     sap01-206 ( 121 ms )