ABAP - Keyword Documentation →  ABAP - Core Data Services (ABAP CDS) →  Obsolete CDS Language Elements →  Obsolete CDS Entities →  ABAP CDS - DDIC-Based Entities (Obsolete) →  ABAP CDS - DDIC-Based Views (Obsolete) → 
Mail Feedback

CDS DDL - DEFINE VIEW ddic_based

Syntax

[@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 CDS DDIC-based view (obsolete) 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:

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.

Hints

Example

The following CDS view works in exactly the same way as the DDIC projection view DEMO_SPFLI in ABAP Dictionary. The class CL_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 (obsolete) DEMO_CDS_PRJCTN returns the client column too.

@AbapCatalog.sqlViewName: 'DEMO_CDS_PRJCTN'
@AccessControl.authorizationCheck: #NOT_REQUIRED
define view demo_cds_spfli
  as select from
    spfli
    {
      key spfli.carrid,
      key spfli.connid,
          spfli.cityfrom,
          spfli.cityto
    }



Continue
CDS DDL - DDIC-Based View, view_annot
CDS DDL - DDIC-Based View, ROOT
CDS DDL - DDIC-Based View, name_list
CDS DDL - DDIC-Based View, parameter_list
CDS DDL - DDIC-Based View, SELECT