SAP CDS DEFINE VIEW ENTITY
Get Example source ABAP code based on a different SAP table
• DEFINE VIEW ENTITY ABAP_CDS_DDL_STATEMENT
• AS ABAP_CDS_DEF_VIEW_ENT
ABAP_CDS_DDL - DEFINE VIEW ENTITY> ABAP_SYNTAX $[@entity_annot1>$]
$[@entity_annot2>$]
...
$[@view_entity_annot1>$]
$[@view_entity_annot2>$]
...
$[DEFINE$] $[ROOT>$] VIEW ENTITY view_entity
$[parameter_list>$]
AS select_statement> $[;$] ...>
ABAP Addition
1 ... ROOT> ...>
What does it do?
Defines a ABAP_CDS_V2_VIEW > 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 TITLE >.
Latest notes:
ABAP annotations> can be used to assign further technical and semantic properties to a view for evaluation by the ABAP runtime framework. Framework-specific annotations> can be used to assign further semantic properties to a view that are evaluated by other SAP frameworks.
If a CDS role> is defined for a CDS entity using the CDS-DCL statement DEFINE ROLE >>, implicit access control> applies by default when the CDS entity is accessed using AB-SQL . CDS access control can be switched off using the value #NOT_ALLOWED> for the annotation @AccessControl.authorizationCheck>> and using the addition WITH PRIVILEGED ACCESS>> in the FROM>> clause of an AB-SQL query.
After a CDS view entity has been transported, its name can no longer be changed.