Ansicht
Dokumentation

ABENCDS_PROJ_VIEW_REDEFINED_ASSOC - CDS PROJ VIEW REDEFINED ASSOC

ABENCDS_PROJ_VIEW_REDEFINED_ASSOC - CDS PROJ VIEW REDEFINED ASSOC

ABAP Short Reference   Vendor Master (General Section)  
This documentation is copyright by SAP AG.
SAP E-Book

- REDEFINE ASSOCIATION, Transactional Query

... REDEFINE ASSOCIATION $[source.$]_ProjAssoc $[ filter$] $[AS _RedefinedName$] redirection  ...

Effect

A CDS association from the projected entity can be redefined in the header part, that means in front of the projection list, of a CDS projection view. In this way, it is possible to modify an association from the underlying view. The modified association can be used locally and it can be exposed in the projection list for usage in, for example, CDS view entity extensions.

The syntax consists of the following elements:

  • _ProjAssoc: the association from the projected entity which should be redefined must be identified by its original name. The association source source can optionally be specified as prefix.
The following rules apply in addition to the rules described in topic CDS Projection View, filter:
The min cardinality can be 0 or 1. The max cardinality can be 1 or *.
The min and max cardinality of redefined to-parent redirects must not be changed.
  • AS alias: A new alias name AS alias can be assigned.
  • redirection: This addition is mandatory for redefined associations. As a prerequisite, the original association target must also be have a CDS projection view. Redirection using the keyword REDIRECTED TO $[...$] means to direct an association to a new association target, which is also a CDS projection view, in this way moving the complete data model to the projection layer.
See topic CDS Projection View, redirection for further details.

Exposure in the projection list:

  • The redefined association can be exposed, but exposure is not mandatory, as it can also be done in CDS view entity extensions later on.
  • Even if an association has been redefined, it is still possible to expose the original association by using the source as prefix.
Example:
Expose redefined association: _assoc.
Expose original association: source._assoc
  • The redefined association can be used in path expressions to expose fields from the association target in the projection list. If a filter condition was added to the redefined association in the header, this is automatically applied to all fields exposed via a path expression.
  • A new alias name can be assigned when exposing a redefined association, even if an alias has already been defined in the context of the redefinition.
  • A new filter condition with a new cardinality can be specified when exposing a redefined association, even if a filter condition with a cardinality has already been defined in the context of the redefinition. In this case, a new alias name is mandatory.

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

Limitations

  • _ProjAssoc can't be specified as path expression.

Notes

  • As alternative to the redefinition described in this topic, a filter condition and redirection can also be specified in the projection list when exposing the association. See topic CDS Projection View, expose_assoc for details.
  • The syntax described in this topic can also be used in a CDS view entity extension using EXTEND VIEW ENTITY.

Example

The following two CDS projection views define a CDS composition relationship to each other. Both of them redefine their associations and redirect the association target to the projection layer, while maintaining the specialization. The CDS view entity extension DEMO_CDS_PV_EXTEND redefines an association to a foreign entity which is not part of the same CDS composition tree.

Parent CDS projection view

Child CDS projection view

CDS view entity extension extending the parent view






Addresses (Business Address Services)   SUBST_MERGE_LIST - merge external lists to one complete list with #if... logic for R3up  
This documentation is copyright by SAP AG.

Length: 7619 Date: 20240512 Time: 090544     sap01-206 ( 85 ms )