Skip to Content
Author's profile photo Tushar Sharma

ABAP Core Data Services – Introduction (ABAP CDS view)

Table of Content:

S.no Topics
1. Introduction
2. Architecture Overview
3. CDS Releases
4. Availability of CDS in SAP Platforms
5. Motivation behind Core Data Services
6. Next Blog’s (Follow)
7. Credits

 


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:

  1. 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?
  2. How can you extend the meta model to service your applications?
  3. 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) data model which the application services expose to UI clients.

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 Pushdowntechniques 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:

  1. 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.
  2. Application layer – This layer contains AS ABAP Backend and SAP Gateway, integrated using RFC calls.
  3. 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:

  1. SAP NetWeaver 7.50, SP01, or higher.
  2. SAP NetWeaver 7.4 SP05
  3. SAP HANA SPS6
  4. SAP Business Suite EHP7 (Suite on HANA)
  5. S/4HANA
  6. SAP Business Warehouse 7.3

Motivation behind Core Data Services

  1. 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.
  2. CDS is completely based on SQL:  Any ‘Standard SQL’ features are directly available like joins, build-in functions,..
  3. 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.
  4. 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]
  5. Associations: Simplified definition of views on top of views. Path expressions to navigate along relations.
  6. 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

Assigned Tags

      20 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Jocelyn Dart
      Jocelyn Dart

      Hi Tushar, It's great you are trying to do a consolidated blog series for beginners on this VERY important topic for anyone coding for Fiori or HANA

      Suggest you also add the link to the latest version of the official guide for this topic to this and all the other blogs in your series, i.e.

      ABAP CDS Development Guide 

      All the best

      Jocelyn

      Author's profile photo Tushar Sharma
      Tushar Sharma
      Blog Post Author

      Hi Jocelyn,

      Thanks for the guidance.  Sure, I'll add all blogs link of my series.

       

      Thank you !

      Author's profile photo Jaideep Adhvaryu
      Jaideep Adhvaryu

      Hi Jocelyn,

      We are evaluating good data extraction from ECC6 to SAP BW and non-SAP system. And looking at ODP and ABAP CDS.

      It seems ODP does NOT support non-SAP target systems. While I am not finding a clear statement if full featured ABAP CDS is also available in ECC6.

      Could you clarify on both ODP & ABAP CDS?

      Thanks!

      AJ

      Author's profile photo Barend Janse van Rensburg
      Barend Janse van Rensburg

      Hi Tushar,

      Thanks for the good information. Do you perhaps have a suggested way to identify a list of all the CDS views available in a S4 HANA system?

       

      Thanks,
      B

      Author's profile photo Tushar Sharma
      Tushar Sharma
      Blog Post Author

      Hi Barend,

      In DDDDLSRCT table you can find all the available CDS views in S/4HANA system.

       

      Thanks,

      Tushar

      Author's profile photo kyo choi
      kyo choi

      You can also use SE11, DDL Source for each tables.

      Author's profile photo Siemens Healthcare BW
      Siemens Healthcare BW

       

      Hello Tushar,
      comparing scripted Calculation Views and CDS Views, what am I supposed to use when ?
      Thanks
      Werner

      Author's profile photo Tushar Sharma
      Tushar Sharma
      Blog Post Author

      Hi Werner,

      Calculation view are composite views and can be used to combine other views like analytical, attribute, other calculation views & tables. This type of view in present in HANA Modelling environment.

      For more information check SAP HANA Modelling guide.

      HANA CDS (Core data services) is a layer above "pure database" in order to define semantically-enriched data models. In contrast to HANA modelling views a HANA CDS document can define tables (called entities), views, table types, asociations and annotations. So, as you can see CDS is mush more powerful than calculation view or any other HANA modelling view.

      For more information check SAP HANA Core Data services (CDS).

      Regarding the detailed information check this discussion thread.

       

      Thanks,

      Tushar

      Author's profile photo kyo choi
      kyo choi

      Calculation views are for Native HANA developments where it's used for large database like BW or DW.  Here the ABAP CDS view is in case we have to use it for SAP S/4 HANA ABAP reports like embedded analytics or creating OData with association and navigation for the UI5 or Fiori Application.

      Author's profile photo Smriti Gupta
      Smriti Gupta

      Hello Tushar,

       

      A well written structured blog for beginners of Cds. Thanks for coming up with the series

      Regards

      Smriti

      Author's profile photo DurgaPrasanth vemula
      DurgaPrasanth vemula

      i have a requirement where i need to disable the field in the standard CDS View 'C_PurchaseReqnItem' and as per the below it is displaying the Field PurReqCreationDate in the "Manage Purchase Requisition Professional" Fiori App.

      @UI: { fieldGroup: { qualifier: 'QuantityDate02', position: 20, importance: #HIGH } }

      Document.PurReqCreationDate,

      Now My Requirement i need to disable the field as i had to use annotation

      @ObjectModel.readOnly: true

      i had done the below code

      @AbapCatalog.sqlViewAppendName: 'ZCPURREQNITM'

      @EndUserText.label: '${ddl_source_description}'

      extend view C_PurchaseReqnItem with zC_PurchaseReqnItem {

      @ObjectModel.readOnly: true

      Document.PurReqCreationDate }

      But I am getting error "View field PURREQCREATIONDATE-C_PURCHASEREQNITEM already exists in parent object (DDL source )" could you please help how to handle this situation.

      Author's profile photo Ila Chaudhary
      Ila Chaudhary

      Hi Tushar,

      Well explained. Very helpful

      Thanks

      Ila Chaudhary

      Author's profile photo Selvakumar Mohan
      Selvakumar Mohan

      2019 Oct - Still the best intro document for CDS ??

      Author's profile photo Jay Malla
      Jay Malla

      We have an ECC system with ABAP 7.50 SP 11 on IBM DB6 but table functions and AMDP is not working.  Is there a document that states which version I need for table functions and AMDP?

      Regards,

      Jay

       

      Author's profile photo Tushar Sharma
      Tushar Sharma
      Blog Post Author

      Hi Jay,

       

      Please go through the below link, I hope you will get your answers there.

      https://help.sap.com/doc/abapdocu_750_index_htm/7.50/en-US/abenamdp.htm

      Author's profile photo Jay Malla
      Jay Malla

      We were unable to use table functions for our ABAP 7.50 SP 11 system on IBM DB6.

      Author's profile photo SRIRAM KRISHNAMOORTHY
      SRIRAM KRISHNAMOORTHY

      Hi Jay,

      Good to see you here in this blog. I am not an expert in CDS, but from my understanding CDS and AMDP are only supported well by HANA database though in principle it also supports few more databases. Especially the AMDP methods only support HANA as per SAP guidelines. Also SAP will only support as per thier agreement for any issues if the underlying database is HANA. So this might be the main reason why table functions is not supported in your case.

      Sriram Krishnamoorthy

      Author's profile photo Param Sadagopan
      Param Sadagopan

      Hi Tushar,

      Well explained. However, if you can give an example of a calculation view as I want to learn how it enhances data models.

      param

      Author's profile photo kyo choi
      kyo choi

      Calculation view is for the HANA DB.  CDS view is for ABAP.

      Author's profile photo srinivasaraju vysyaraju
      srinivasaraju vysyaraju

      Hi Tushar,

      Well explained. Very helpful

      Thanks,

      Srinivasaraju V