Ansicht
Dokumentation
ABENCDS_PROJ_VIEW_VIRTUAL_ELEMENT - CDS PROJ VIEW VIRTUAL ELEMENT
Fill RESBD Structure from EBP Component Structure ABAP Short ReferenceThis documentation is copyright by SAP AG.
- VIRTUAL
... VIRTUAL elem_name : typing
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. Reading the virtual elements of a projection view with ABAP SQL delivers initial values. In order to fill and analyze the virtual elements of projection views, special frameworks like the RAP query engine have to be involved.
In RAP, for example, a virtual element can be connected to an ABAP class that implements a special virtual element interface by using the framework-specific annotation ObjectModel.virtualElementCalculatedBy. In that case the value of the virtual element is calculated during runtime by the RAP query engine. For more information, see the development guide for the ABAP RESTful Application Programming Model, section Using Virtual Elements in CDS Projection Views.
Note
Virtual elements are also supported in CDS projection views that implement data retrieval via an ABAP
class using the annotation
ObjectModel.query.implementedBy. This can be useful, for example, in extensibility scenarios. In this case, the ABAP query is evaluated first and the virtual element can use the returned values.
Example
The projection view DEMO_SALES_PV_SO_EXP is based on the CDS view
DEMO_SALES_CDS_SO. It contains a virtual element expiry_date that is bound to ABAP class
CL_DEMO_SALES_VIRT_ELEM_EXIT that calculates the expiry date of an item during runtime if the view is accessed by the
RAP query engine..
The executable example Calculating
a virtual element accesses the CDS projection view shown above and returns the result of the virtual element.
General Data in Customer Master rdisp/max_wprun_time - Maximum work process run time
This documentation is copyright by SAP AG.
Length: 3594 Date: 20240418 Time: 122206 sap01-206 ( 46 ms )