Table of Content:
After the evolution of SAP HANA, the technology within the SAP is changing rapidly and there has been a paradigm shift in the way business applications are developed at SAP.
The rule of thumb is simple:
"Do as much as you can in the database to get the best performance".
When I started learning about ABAP CDS views few months back, I had to search many different blogs and pages written by the experts. Now, I thought of presenting a blog series for the beginners like me who are keen to learn ABAP CDS views.
Let's Start !!
Introduction
Data models are a cornerstone of application development. They provide a standardized method for defining and formatting database contents consistently across systems, enabling different applications to share the same data — reducing development costs, speeding time to market, and improving quality and performance.
Those familiar with application development in the ABAP world are no strangers to the traditional data modeling tools included with SAP NetWeaver Application Server (SAP NetWeaver AS) ABAP — in particular, the ABAP data dictionary (DDIC), which stores definitions of objects, such as database tables and views, that can be used in ABAP programs. And then along came SAP HANA and the new paradigm of pushing down data-intensive logic to the database layer.
The concept of Virtual Data Model (VDM) was introduced with HANA Live few years ago, SAP HANA Live is a Virtual data model on top of suite tables which uses native SAP HANA SQL views called Calculation views for real-time operational Reporting.
This came with certain challenges:
- It didn’t support hierarchies properly. Hierarchies help businesses to analyze their data in a tree structure through different layers with drilldown capability. For example, a time hierarchy consists comprises of levels such as fiscal year, fiscal quarter, fiscal month and so on.
- High quality data models should provide a single definition and format for the data. They should be clear and unambiguous, reusable and flexible, even extensible.
- Since, the HANA Live virtual data models were defined in the HANA database layer it led to duplication of security roles between Business Suite for transactional processing and HANA database for operational reporting.
Now, some questions comes in mind:
- So how can you capture the semantics of the data model in the database so that the model can be easily reused by different consumers, e.g. by OData clients and by OLAP tools?
- How can you extend the meta model to service your applications?
- Impossible, you say?
Maybe, if we didn’t have
Core Data Services (CDS).
"Core Data Services to build design-time data-persistence models"
It is an infrastructure that can be used by database developers to create the underlying (persistent...
To take advantage of
SAP HANA for application development, SAP introduced a new data modeling infrastructure known as
Core data services. With CDS, data models are defined and consumed on database server rather than on application server. CDS also offers capabilities beyond the traditional data modeling tools, including support for conceptual modeling and relationship definitions, built-in functions, and extensions. Originally, CDS was available only in the design-time and runtime environment of SAP HANA. Now, the CDS concept is also fully implemented in
SAP NetWeaver AS ABAP, enabling developers to work in the ABAP layer with ABAP development tools while the code execution is pushed down to the database.
CDS simplifies and harmonizes the way you define and consume your data models, regardless of the consumption technology. Technically, it is an enhancement of SQL which provides you with a data definition language (DDL) for defining semantically rich database tables/views (CDS entities) and user-defined types in the database. Some enhancements include:
- Expressions used for calculations and queries in the data model
- Associations on a conceptual level, replacing joins with simple path expressions in queries
- Annotations to enrich the data models with additional (domain specific) metadata
CDS is supported natively in both the ABAP and the HANA Platforms !
In fact, CDS is (in my opinion) the most ambitious and exciting SAP development in the area of data modeling in recent years. You can finally define and consume your data models in the same way (syntax, behaviour, etc.) regardless of the SAP technology platform (ABAP or HANA). Unwantedly the phrase: “
One Data Model to rule them all” always comes to mind when I think of CDS.
Besides a great blog by
horst.keller, describes the two different flavors of CDS.
Core Data Services - One Concept, Two Flavors
After going through the above blog, we came to know that CDS can be written in two different flavours and uses the
"Code Pushdown" techniques introduced with NW AS ABAP 7.4 SP5 where SAP added new possibility for ABAP developers to
leverage HANA capabilities. In code pushdown technique all calculations are performed on database layer instead of application layer, which results in fast retrieval of data, resulting cutback of application execution.
Architecture overview
The CDS architecture looks something as shown below:
- Database layer - This layer can be configured with most of the popular DB like Oracle, SAP HANA, etc.. However, to get the best result it's recommended to have SAP HANA.
- Application layer - This layer contains AS ABAP Backend and SAP Gateway, integrated using RFC calls.
- Presentation layer - This layer contains SAP Fiori User Interface for exposing the applications for the end user.
CDS Releases
Below is an overview of changes in CDS functionalities with the ABAP specific releases.
For more details see -
Feature Matrix.
S.no |
ABAP Release |
Changes with ABAP specific releases |
1. |
In ABAP 7.40, SP05 |
CDS views has been introduced. |
2. |
In ABAP 7.40, SP08 |
CDS annotations |
CDS views with parameters |
CDS view enhancements |
Expressions and Functions |
Join type for associations |
Path expression with filter conditions |
Checking literals against fixed domain values |
|
3. |
In ABAP 7.40, SP10 |
CDS Access Control |
4. |
In ABAP 7.50, SP00 |
CDS Table functions |
Session variables |
CDS view with input parameters |
Annotation for input parameters |
Key fields |
Evaluation of annotations |
Publishing associations |
Extensions |
|
5. |
In ABAP 7.51, SP00 |
Client handling |
Cross Joins |
Annotations |
|
Availability of CDS in SAP Platforms
The Core Data services are available in below mentioned SAP Platforms:
- SAP NetWeaver 7.50, SP01, or higher.
- SAP NetWeaver 7.4 SP05
- SAP HANA SPS6
- SAP Business Suite EHP7 (Suite on HANA)
- S/4HANA
- SAP Business Warehouse 7.3
Motivation behind Core Data Services
- Semantically Rich data-models: Entity relationship model and is declarative in nature, very close to conceptual concept.Domain specific languages (DDL, QL, DCL). Declarative, close to conceptual thinking.
- CDS is completely based on SQL: Any ‘Standard SQL' features are directly available like joins, build-in functions,..
- Fully Compatible across any DB: CDS is generated into managed Open SQL views and is integrated into SAP HANA layer. These views are supported by all major DB.
- Support for Annotations: CDS syntax supports domain-specific annotations that can be easily evaluated by other components, such as the UI, analytics, and OData services.
- @AnalyticsDetails.aggregrationBehaviour
- SUM()
- Substring() [SQL functions]
- Associations: Simplified definition of views on top of views. Path expressions to navigate along relations.
- Extensibility: We can extend SAP-defined CDS views with fields that will be automatically added to the CDS view along with its usage hierarchy.
- On model level through extensions.
- On meta-model level through annotations.
CDS entities and their metadata are extensible and optimally integrated into the ABAP Data Dictionary and the ABAP language.
To keep the focus on core objective (Core Data Services) of this blog, I tried to make it as small as possible.
Suggestions and questions are welcomed !!
Follow:-
Thank you.
Credits:-
ABAP CDS Development Guide
Core Data Services- Overview & Concepts
SAP Community Wiki - Core Data Services
New Data Modeling Features in SAP NW ABAP 7.4 SP5
Core Data Services [CDS] in SAP S/4 HANA
ABAP CDS Feature Matrix