ABAP CDS - General Syntax Rules
- Keywords must be all uppercase, all lowercase, or in lowercase with an uppercase initial letter. Other mixes of uppercase and lowercase are not allowed.
- Names are not case-sensitive.
- A name must contain at least 2 characters but no more than 30 characters.
- A name can consist of letters, numbers, underscores (_), and slashes (/).
- A name must start with a letter, slash character, or underscore. Underscores are recommended as the naming convention for CDS associations.
- The separator for names with multiple parts is a period (.). Names with multiple parts can be paths, columns with a prefixed data source, and structured annotations.
- The following CDS keywords cannot be used as names:
ALL, AND, AS, ASSOCIATION, AVG, CASE, CAST, COUNT, CROSS, DISTINCT, EXISTS, EXTEND, EXTENSION, FROM, FULL, GROUP, HAVING, INNER, JOIN, KEY, LEFT, MAX, MIN, NOT, NULL, ON, OR, ORDER, RIGHT, SELECT, SUM, UNION, VIEW, WHEN, WHERE
- Numeric literals must always be specified in full and a decimal point (.) used as a decimal separator if necessary.
- Character literals are enclosed in single quotation marks (').
- Two forward slashes (//) introduce a comment, which continues until the end of the line.
- Comments within lines or that span multiple lines are enclosed by the characters /* and */.
- Statements can be closed using a semicolon (;). Sometimes this is mandatory.
- Protected words
- Certain keywords are protected and cannot be used as self-defined names. The reserved names that cannot be used are specified in the database table TRESE.
7.31 | 7.40 | 7.54
- The closing semicolon after a statement is sometimes optional because one piece of CDS source code can currently only contain a single statement.
- In DDL source code for CDS data definitions and DCL source code for CDS roles, as well as two slashes, two dashes (--) can also be used to introduce a comment. Slashes (//), however, are the recommended method. Two dashes are not allowed in DDLA source code for annotation definitions and in DDLX source code for metadata extensions.
- SELECT, select, and Select are all valid ways of specifying a keyword. seLect and SeLect, on the other hand, produce syntax errors.
- MYVIEW, myview, and myView all identify the same operand.
- 0.5 is a valid numeric literal, but .5 is not.