Ansicht
Dokumentation
ABENCDS_PROJ_VIEW_ELEMENT - CDS PROJ VIEW ELEMENT
General Material Data ABAP Short ReferenceThis documentation is copyright by SAP AG.
- proj_element, Transactional Query
... $[@element_annot1$]
$[@element_annot2$]
...
${$[KEY$] ${proj_element $[AS alias$]$}
$| ${expose_assoc
$[AS alias$]$}
$| ${path_expr.element $[AS alias$]$[: LOCALIZED$]$}
$| ${cast_expr
AS alias$}$}
$|${$[VIRTUAL elem_name : typing$]$}
Additions
1. ... KEY
2. ... AS alias
3. ... LOCALIZED
4. ... VIRTUAL
Effect
Defines which elements of the projected entity are part of the CDS projection view. Only elements from the projected entity can be specified as projected element.
- The rules for propagation of element annotations in CDS projection views apply.
- proj_element exposes an element from the projected entity. AS can be used to define an alternative element name alias.
- In transactional projection views, an element from the projected entity can be exposed multiple times with different alias names.
- expose_assoc exposes a CDS association, a CDS composition, or a CDS to-parent association from the projected entity. Exposed associations can be redirected to a new target when the association target is also projected. The keyword REDIRECTED TO is introduced in topic CDS DDL - CDS Projection View, expose_assoc.
- 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.
- path_expr.element exposes an element of an association target of the projected entity. If no alternative element name alias is defined, the element name is defined by the name of the element named by the path expression. The keyword LOCALIZED can be used to display text elements in the user's logon language. All associations that are part of the path expression must be filtered to 1. For details, see the topic about path expressions in CDS projection views.
- A cast_expr can be used to assign a new data element to a field, for example to get additional semantic information. The addition PRESERVING TYPE is mandatory and must be used. For a cast expression, an alias name must be specified with the keyword AS.
- In CDS projection views, only a limited form of cast expressions is available. Cast expressions can only be used to assign a data element to a field, but not for type conversion.
Example
The following CDS projection view DEMO_SALES_PV_SO_I_LIST is a projection of the CDS view
DEMO_SALES_CDS_SO_I. It contains details about a sales order item.
Addition 1
... KEY
Effect
The keyword KEY is used to define the current element as a key element of the
CDS projection
view. A CDS projection view must define exactly the same key elements in the same order as key elements as the underlying projected entity.
Addition 2
... AS alias
Effect
Defines an alternative element name for the projected element. The alternative element name replaces the actual name of the element from the
projected
entity. The view field is created under the alternative element name in the CDS projection view. Accordingly, the alternative element name must comply with the general syntax rules for
names.
Addition 3
... LOCALIZED
Effect
The keyword LOCALIZED can be used to display text elements in the current system language. As a prerequisite, you must establish a text association to a text provider view that contains text elements in different languages. It is mandatory that all association paths in the path expression must be filtered to 1. Then, by using the keyword LOCALIZED, the text elements are chosen in the user's logon language. So in the example shown above, the keyword LOCALIZED is a realization of the path expression _Text[1:Language=$session.system_language].material_name.
Find out how to define a text association in the developer guide for the ABAP RESTful Programming Model, in the section about text associations.
Addition 4
... VIRTUAL
Effect
Defines a virtual element in the projection list of a CDS projection view. Virtual elements are read-only elements of a CDS projection view which are not part of the projected entity. For further details, see topic CDS DDL - VIRTUAL.
rdisp/max_wprun_time - Maximum work process run time rdisp/max_wprun_time - Maximum work process run time
This documentation is copyright by SAP AG.
Length: 10201 Date: 20240419 Time: 033506 sap01-206 ( 137 ms )