Skip to content

ABAP Keyword Documentation →  ABAP - Dictionary →  ABAP CDS in ABAP Dictionary →  ABAP CDS - Syntax 

ABAP CDS - Language Elements

The following sections summarize the language elements of the CDS DDL and CDS DCL in ABAP CDS, arranged by topics.

In addition to the language elements shown here, CDS source code can also contain annotations with metadata.

Other versions: 7.31 | 7.40 | 7.54

DDL

CDS Annotation Definitions

Keywords and Additions

Language Element Meaning
define annotation ... Defines a CDS annotation
enum Defines enumeration symbols of a CDS annotation
default Defines default values of a CDS annotation
array of Defines an annotation arras.

CDS Views

Keywords and Additions

Language Element Meaning
DEFINE VIEW ... AS Defines a CDS view
WITH PARAMETERS Defines input parameters of a CDS view
SELECT [DISTINCT] ... FROM SELECT statement of a CDS view
INNER JOIN ... ON Inner join in a SELECT statement
LEFT RIGHT OUTER JOIN ... ON
ASSOCIATION ... TO ... AS ... ON Defines a CDS association for a path expressionin a SELECT statement
WITH DEFAULT FILTER Specifies a default filter condition of a CDS association
1: Attribute of a path expression
INNER ... WHERE Attribute of a path expression
LEFT OUTER ... WHERE Attribute of a path expression
KEY ... AS Element of a SELECT list
$EXTENSION.* Elements of an enhancement in a SELECT list
WHERE ... WHERE clause of a SELECT statement
GROUP BY ... GROUP-BY clause of a SELECT statement
HAVING ... HAVING clause of a SELECT statement
UNION ALL ... UNION clause of a SELECT statement

Expressions

Operators Meaning
MAX,MIN, AVG [AS dtype], SUM, COUNT Aggregate expression in a SELECT statement
+,-, *, / Arithmetic expression in a SELECT statement
CASE, WHEN, THEN, ELSE, END Case distinction in a SELECT statement
CAST Cast expression in a SELECT statement
=, <>, <,>, <=, >=,BETWEEN, LIKE, ISNULL, NOT,AND, OR Relational expression in a SELECT statement

Built-In Functions

Function Meaning
ABS,CEIL,DIV, DIVISION, FLOOR, MOD,ROUND Numeric function in a SELECT statement
CONCAT,CONCAT_WITH_SPACE,INSTR,LEFT,LENGTH,LPAD,LOWER,LTRIM,REPLACE,RIGHT,RPAD,RTRIM,SUBSTRING,UPPER String function in a SELECT statement
BINTOHEX, HEXTOBIN Byte string function in a SELECT statement
COALESCE Coalesce function in a SELECT statement
FLTP_TO_DEC,UNIT_CONVERSION,CURRENCY_CONVERSION,DECIMAL_SHIFT Conversion functions in a SELECT statement
DATS_IS_VALID,DATS_DAYS_BETWEEN,DATS_ADD_DAYS,DATS_ADD_MONTHS Date function in a SELECT statement
TIMS_IS_VALID Time function in a SELECT statement
TSTMP_IS_VALID,TSTMP_CURRENT_UTCTIMESTAMP,TSTMP_SECONDS_BETWEEN,TSTMP_ADD_SECONDS Time stamp function in a SELECT statement
ABAP_SYSTEM_TIMEZONE,ABAP_USER_TIMEZONE Time zone functions in a SELECT statement
TSTMP_TO_DATS,TSTMP_TO_TIMS,TSTMP_TO_DST,DATS_TIMS_TO_TSTMP Date/time conversions functions in a SELECT statement

CDS View Enhancements

Keywords and Additions

Language Element Meaning
EXTEND VIEW ... WITH Extends a CDS view using aCDS view extension

CDS Table Functions

Keywords and Additions

Language Element Meaning
DEFINE TABLE FUNCTION ... RETURNS ... IMPLEMENTED BY METHOD ... Defines a CDS table function

CDS Hierarchies

Keywords and Additions

Language Element Meaning
DEFINE HIERARCHY ... Defines a CDS hierarchy
WITH PARAMETERS Defines input parameters of a CDS hierarchy
AS PARENT CHILD HIERARCHY Defines a CDS hierarchy using parent-child relationships
SOURCE ... Specifies the data source of a CDS hierarchy
CHILD TO PARENT ASSOCIATION Specifies the hierarchy association of aCDS hierarchy
PERIOD FROM ... TO ... VALID FROM ... TO ... Defines a temporal hierarchy
DIRECTORY ... FILTER BY ... Specifies a condition for the source of a CDS hierarchy
START WHERE ... Specifies the start condition of a CDS hierarchy
SIBLINGS ORDER BY ... Specifies the sort order of sibling nodes in aCDS hierarchy
DEPTH ... Delimits the hierarchy levels of aCDS hierarchy
NODETYPE ... Defines an element as a node type for a CDS hierarchy
MULTIPLE PARENTS ... Defines the behavior that applies if multipleparent nodes are specified in a CDS hierarchy
ORPHANS ... Defines the behavior that applies if orphan nodes are specified in aCDS hierarchy
CYCLES ... Defines the behavior that applies if node cycles are specified in aCDS hierarchy
GENERATE SPANTREE Reduces a CDS hierarchy to a tree

Abstract CDS Entities

Keywords and Additions

Language Element Meaning
DEFINE ABSTRACT ENTITY ... Defines an abstract CDS entity
WITH PARAMETERS Defines input parameters of an abstract CDS entity.
ASSOCIATION ... TO ... ON Publishes a CDS association in the element list of anabstract CDS entity
WITH DEFAULT FILTER Specifies a default filter condition of a CDS association

CDS Metadata Extensions

Keywords and Additions

Language Element Meaning
ANNOTATE ENTITY VIEW ... WITH
VARIANT Joins a CDS metadata extension with aCDS variant
PARAMETERS Extends the annotations of the input parameters of a CDS entity

DCL

CDS Roles

Keywords and Additions

Language Element Meaning
DEFINE ROLE Defines a CDS role
GRANT SELECT ON Defines an access rule in a CDS role
WHERE WHERE clause in a conditional access rule of a CDS role
AND, OR, NOT Boolean operator in a conditional access rule of a CDS role
INHERIT Defines an inherited access rule of a CDS role (obsolete)
ASPECT pfcg_auth,
ASPECT user
Conditions for CDS roles
PFCG_MAPPING Specifies a PFCG mapping in aPFCG condition of a CDS role
INHERIT ... FOR GRANT SELECT ON Defines an inheritance condition of aCDS role
...= <>

CDS access policy

Keywords and Additions

Language Element Meaning
DEFINE ACCESSPOLICY Defines a CDS access policy
DEFINE PFCG_MAPPING ... BETWEEN ... AND ... USING ... Defines a PFCG mapping in an access policy