CDS Views Basic Syntaxes : – Select *, Select columns, Select distinct, WHERE clause, Table Aliases, Key Elements ,DDL Syntax Rules, CREATE SQL statement


1. CDS View – Select *
Select * – selects all columns from the underlying data source.

Output in Data Preview:

2. CDS View – Select columns

Comma separated list of names
optional alias names with keyword AS

Alternative Syntax
select list after from clause enclosed in curly braces {….}

3. CDS Views – Select columns

Literals are only supported:
as C-Sequence Literals (Max length 1333)
as signed integer Literals (4-Byte)

4. CDS Views – Select distinct

Duplicates can occur when a key column is not included in the projection list


The keyword DISTINCT ensures that the result table contains no duplicates:

5. CDS Views – WHERE

You can use compound WHERE clauses.

6. CDS Views – Table Aliases

Table aliases are defined in the FROM clause.
You can use table aliases in the projection list.

Here below we have ‘c’ as Table Alias for table scarr

7. CDS View – Key Elements

Key elements should be continuous and placed at the start of the list.

CDS View key fields need not be same as of the underlying data source.

Key fields for the generated SQL view is not derived from the key fields of the CDS view.

General DDL Syntax Rules

  • Keywords: Keywords must be all uppercase, all lowercase, or in lowercase with an uppercase initial letter. Mixed uppercase and lowercase is not allowed.
  • Names: Names are not case-sensitive. A name can have a maximum of 30 characters.
  • Literals: Number literals must always be specified in full and a decimal point (.) used as a decimal separator if necessary. Character literals are enclosed in single quotations marks (‘).
  • Comments: 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 */.
  • Separators: Statements can be closed using a semicolon (;). This is optional.
  • Protected Words: Certain keywords are protected and cannot be used as self-defined names.

Syntax Rules – Examples

SELECT, select, and SelectValid ways of specifying a keyword.
seLect and SeLect Invalid, produce syntax errors.
MYVIEW, myview, and myView all identify the same operand.
0.5 is a valid number literal, but .5 is not.

How to consume CDS view in a report?

Generated SQL Statement for CDS View

Two ways to get the generated CREATE SQL statement in the database for the CDS view
1. Right Click on the CDS source editor in Eclipse and select “Show SQL CREATE Statement”.
2. Open the generated database view in SE11 and select Menu -> Extras -> CREATE Statement.




Please enter your comment!
Please enter your name here