Mentor SAP

A New Syntax for Open SQL

 

As off AS ABAP 7.40 SP05, ABAP open SQL offers a large variety of new features. In order to make this possible, it was necessary to re-design the syntax of Open SQL. The new syntax rules as off NW 7.40 are as follows:

  1. Comma-separated column list- to allow for sophisticated expressions
  2. Mandatory escape character @ for ABAP data objects – to ensure a clear distinction between database objects and objects of the ABAP program.

Regarding the usage of old syntax and new syntax, the following rules apply:

  1. If an SQL statement uses the new syntax, it must use it consequently
  2. An SQL statement may use the old syntax if it contains only features that were already available before NW 7.40 SP05
  3. As soon as an SQL statement contains a single feature that was introduced in or after NW 7.40 SP05, it must follow the new syntax rules.

 

 

AS ABAP 7.50 brought more new features to open SQL and, along with those, additional changes to the syntax. Most important, the sequence of clauses was changed as follows:

Regarding the usage of this new syntax, the following rules apply:

One DDL source – Two objects to read the from

 

To use CDS in ABAP Open SQL, you can read either from the SQL View or from the CDS view. This might be a bit surprising because only the SQL view exists physically on the database. But if you read from the CDS view, the database interface will replace the name of the CDS view with the name of the corresponding SQL view when translating your open SQL statement into a native SQL statement. This is the recommended way to access CDS view in ABAP.