SAP introduces a set of domain-specific languages and services, called CDS, for defining and consuming semantically rich data models.
CDS are not only an integral part of SAP HANA but can also be leveraged in the ABAP stack and are optimally integrated into the ABAP Dictionary and language. The corresponding new ABAP Repository object types DDL Source and DCL source, for defining enhanced view entities in ABAP, allow you to push more data-intensive calculations to the database than is possible using classical ABAP Dictionary Views.
ABAP CDS share views with ABAP Dictionary that are supported on all database systems and supported by the ABAP stack. However, ABAP CDS views provide the following additional capabilities:
CDS in ABAP
To create CDS views, do the following:
Annotations allow for the specification of ABAP-specific additional information, such as how records of the view should be buffered by the ABAP table buffer, or whether the view is client-dependent or not. By default, CDS views are considered client-dependent.
The annotation @AbapCatalog.sqlViewName is mandatory and specifies the name of the representation of the DDL source in the ABAP Dictionary and the database. Like the new Open SQL, CDS supports various expressions as in the below picture:
Beginning with ABAP 7.5, the following considerably larger set of functions is supported in expressions in ABAP CDS
Code |
Functions |
Dats_days_between |
Computes the difference between dates in days |
Dats_add_days |
Add N days to a given date |
Dats_add_months |
Add N month to a given date |
Dats_is_valid |
Checks if input value is valid date |
Tstmp_current_utctimestamp |
Determines the current timestamp in universal coordinated time |
Tstmp_seconds_between |
Computes the difference between timestamps in seconds |
Tstmp_add_seconds |
Add N seconds to a given timestamp |
Tstmp_is_valid |
Checks if input value is a valid timestamp |
Tims_is_valid |
Checks if input value is a valid time |
Concat_with_space |
Returns its argument concatenated, with n spaces add in between |
Length |
Determines the length of argument |
Instr |
Returns the position of matching string in the first argument |
Left and right |
Returns the n left/right characters of the first argument |
Ltrim and rtrim |
Returns the first argument with the leading/ trailing characters matching the second argument removed |
Lpad and rpad |