ABAP - Keyword Documentation →  ABAP - Core Data Services (ABAP CDS) →  ABAP CDS - Data Definitions →  ABAP CDS - DDL for Data Definitions →  ABAP CDS - CDS Entities →  ABAP CDS - View Entities → 
Mail Feedback

CDS DDL - DEFINE VIEW ENTITY

Syntax

[@entity_annot1]
[@entity_annot2]
...
[@view_entity_annot1]
[@view_entity_annot2]
...
[DEFINE] [ROOT] VIEW ENTITY view_entity
        [parameter_list]
         AS select_statement [;]...


Additions:

1. ... ROOT ...

Effect

Defines a CDS view entity in the CDS DDL. A CDS view entity is implemented using a select_statement.

The name of the CDS view entity is defined after the DEFINE VIEW ENTITY statement. The usual rules for ABAP Dictionary views apply to this name and it is not case-sensitive (it is transformed internally into uppercase letters). It can have a maximum of 30 characters and is in the namespace of all global types of an AS ABAP. The name of the DDL source and of the CDS entity must be identical.

The CDS view entity can be enhanced with entity annotations (these are annotations that can be used in all CDS entities) or with view entity annotations (these are annotations that are only available for CDS view entities). All annotations are optional and a view entity can also be created without any annotation.

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.

The addition ROOT is optional. It defines the CDS view entity as root entity of a RAP business object in the ABAP RESTful Application Programming Model. For further details, see topic CDS DDL - CDS View Entity, ROOT.

Hints

Example

The CDS view entity DEMO_SALES_CDS_BUPA_VE contains information about a business partner. It selects data from the database table DEMO_SALES_BUPA.

@AccessControl.authorizationCheck: #NOT_REQUIRED
@EndUserText.label: 'SDDL: Interface (BO) View for BuPa'
define root view entity DEMO_SALES_CDS_BUPA_VE
  as select from
    demo_sales_bupa as bupa
    {
      key id,
          given_name,
          middle_name,
          family_name
    }



Continue
CDS DDL - CDS View Entity, view_entity_annot
CDS DDL - CDS View Entity, ROOT
CDS DDL - CDS View Entity, parameter_list
CDS DDL - CDS View Entity, SELECT