Ansicht
Dokumentation

ABENCDS_PROJ_VIEW_ASSOCIATION - CDS PROJ VIEW ASSOCIATION

ABENCDS_PROJ_VIEW_ASSOCIATION - CDS PROJ VIEW ASSOCIATION

TXBHW - Original Tax Base Amount in Local Currency   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

- ASSOCIATION, Transactional Query

... ASSOCIATION $[ [min..max] $] TO target $[AS _assoc$] ON cds_cond
                $[ WITH DEFAULT FILTER cds_cond $] ...


Effect

Defines a CDS association with the name _assoc in a CDS projection view. The same rules apply as for associations in CDS view entities, but there are further restrictions. The main difference is that the newly defined associations can only be exposed, but they cannot be used in path expressions to include elements from the association target. The purpose of defining new associations is to model new relationships which can be interpreted by consumer frameworks, such as the RAP query engine. However, no additional joins should be generated on CDS level by denormalizing fields from new association targets into the CDS projection view. Only "simple" associations can be defined in a CDS projection view. Specialized associations of type composition or to-parent are not supported.

The target of the locally defined association target can be any other CDS entity, a DDIC database table, or a DDIC database view.

All elements included in the ON clause of an exposed CDS association must also be included in the projection list of the CDS projection view.

Syntax rules

  • New associations in CDS projection views are defined in exactly the same way as associations in CDS view entities. The same rules apply to the additions [min..max], AS _assoc, WITH DEFAULT FILTER, and the ON condition. See topic CDS DDL - CDS View Entity, ASSOCIATION.

Exposure in the projection list

  • The newly defined association can be exposed, but exposure is not mandatory, as it can also be done in CDS view entity extensions later on.
  • An alias name alias can be assigned to the exposed association.
  • It is possible to enhance a locally defined association with an additional filter when exposing it in the projection list. Two kinds of attributes can be added in square brackets as filter: cardinality and filter condition. It is not possible to specify join type characteristics in the filter. The details are described in topic CDS DDL - CDS Projection View, filter.
When exposing a CDS association with a filter, an alternative element name alias using AS is mandatory.
Here's an example: _toAssoc[1:field='1'] as filteredAssoc
  • A CDS association can be exposed multiple times with various alternative element names. This makes it possible to use different filter conditions.
  • An exposed CDS association is part of the projection list. It is not, however, part of the result set, nor a component of the type defined in ABAP with respect to the CDS projection view.

Usage

  • No fields must be selected from locally defined associations. Path expressions are not supported.

Client dependency

  • A CDS projection view that is based on a client-independent CDS view must not contain an association to a client-dependent target view. Client dependency must not be changed by introducing a new association. This also applies to CDS view extensions later on, as this may lead to incompatibilities.

Note

Redirection of a newly defined association with the keyword REDIRECTED TO is not possible.

Example

The following CDS projection view DEMO_SALES_PV_SO_ASSOC is a projection of the CDS view entity DEMO_SALES_CDS_SO. It defines associations to a CDS custom entity and a CDS DDIC-based view. These associations are exposed in the element list, but no fields are picked from the associations via a path expression.






rdisp/max_wprun_time - Maximum work process run time   Fill RESBD Structure from EBP Component Structure  
This documentation is copyright by SAP AG.

Length: 7592 Date: 20240419 Time: 204042     sap01-206 ( 84 ms )