Ansicht
Dokumentation

ABENCDS_DEFINE_VIEW_V1 - CDS DEFINE VIEW V1

ABENCDS_DEFINE_VIEW_V1 - CDS DEFINE VIEW V1

RFUMSV00 - Advance Return for Tax on Sales/Purchases   Fill RESBD Structure from EBP Component Structure  
This documentation is copyright by SAP AG.
SAP E-Book

- DEFINE VIEW ddic_based

$[@entity_annot1$]
$[@entity_annot2$]
...
@AbapCatalog.sqlViewName: 'CDS_DB_VIEW'
$[@view_annot1$]
$[@view_annot2$]
...
$[DEFINE$] $[ROOT$] VIEW ddic_based_view
        $[name_list$]
        $[parameter_list$]
         AS select_statement $[;$]


Effect

Defines a in the CDS DDL. A CDS view is implemented using a query select_statement. The annotation AbapCatalog.sqlViewName must be specified before the view itself is defined using DEFINE VIEW. Further optional annotations entity_annot1, ..., view_annot1, ... can also be specified.

Two repository objects are created for a CDS view (of the ABAP CDS) that is defined using DEFINE VIEW. A name must be specified for each of the two objects:

  • The name CDS_DB_VIEW of the CDS-managed DDIC view must be specified in quotation marks after the annotation @AbapCatalog.sqlViewName. This view is the technical foundation of the CDS view in ABAP Dictionary. The usual rules for ABAP Dictionary views apply to this name and it is not case-sensitive (it is transformed internally into uppercase letters). The associated SQL view is created under this name on the database. The name given to the DDIC database view can no longer be changed after the CDS view is transported into a follow-on system.
  • The name ddic_based_view of the CDS entity is defined after the keywords DEFINE VIEW (DEFINE is optional). No quotation marks need to be specified. This name follows the rules of the CDS-managed DDIC view, but can have 30 characters. The CDS entity represents all properties of the CDS view.

Both names are in the namespace of all global types of an AS ABAP. and must each be unique. The name ddic_based_view of the CDS entity can be used in other CDS DDL statements or in ABAP programs to access the CDS view.

The information specified in name_list can be used to define the names of the elements of the view in a name list. parameter_list can be used to assign input parameters to the view. These input parameters can be specified in operand positions of the view and can be assigned actual parameters when the view is used.

Notes

  • The CDS-managed DDIC view of a CDS view defined using DEFINE VIEW can be displayed by entering the name CDS_DB_VIEW in the ABAP Dictionary tool in ABAP Workbench. However the view cannot be maintained here. Furthermore, this display does not provide all information.
  • The CDS-managed DDIC view CDS_DB_VIEW can also be accessed directly in the CDS DDL and in ABAP. It is strongly recommended, however, that only the CDS entity is used, since only this entity covers all properties of the CDS view. This makes the use of the CDS-managed DDIC view in obsolete.
  • ABAP annotations can be used to assign further technical and semantic attributes to a view for evaluation by the ABAP runtime framework. Framework-specific annotations can be used to give the element specific semantic attributes for other SAP frameworks.
  • If a CDS entity is accessed using an SELECT statement and the name ddic_based_view, the syntax check is performed in strict mode, which handles the statement more strictly than the regular syntax check.
  • The DDL source code of a CDS view does not need to have the same name as the CDS entity, but it is advisable to use this name.
  • After a piece of DDL source code is transported, the combination of its name and the name of the CDS view defined in it and its CDS-managed DDIC view is defined and can no longer be modified by being renamed.

Example

The following CDS view works in exactly the same way as the DDIC projection view DEMO_SPFLI in ABAP Dictionary. The program DEMO_CDS_PROJECTION uses SELECT to access the view. Unlike when the DDIC view DEMO_SPFLI is accessed, no client column is returned when the CDS entity DEMO_CDS_SPFLI is accessed. The CDS-managed DDIC view DEMO_CDS_PRJCTN returns the client column too.






General Material Data   Fill RESBD Structure from EBP Component Structure  
This documentation is copyright by SAP AG.

Length: 10978 Date: 20240329 Time: 091152     sap01-206 ( 130 ms )