Brook Preloader


ABAP Core Data Services

What is Core data Service?

Core Data Service (CDS) is a semantically rich data definition language created by SAP. We can define and consume data models on the database rather than on application server by using CDS views.

CDS views is a platform used to create Data models by which data can be transferred to outside applications using ODATA services.

Advantages of CDS Views:

  • CDS view is a Code-to-data paradigm technique in ABAP where we perform all computations and calculations on DB layer, instead of fetching all the data to the application server and then processing the data to do computations.
  • CDS views are very rich in features which are less conventional in SE11 views.
  • CDS views can also be accessed out of the native SAP applications.
  • CDS views are database independent and run on any SAP supported database system.
  • With CDS, we can define calculated fields in views.
  • CDS views support automatic client handling.
  • We can publish ODATA services directly from CDS views using annotations.
  • We can create UI5 applications by CDS views using UI annotations.

Code-to-data paradigm in ABAP:

Annotations in CDS:

Annotations are used to add metadata to CDS view, modify the properties of the view in ABAP dictionary and its behaviour when accessed at runtime.

SAP annotations are divided into two categories.

  • ABAP CDS annotations – Evaluated by ABAP runtime environment
  • Component annotations – Evaluated by relevant SAP framework

SAP provides a number of annotations for CDS views, but in this article we discuss a few of them.

The following list summarizes all AbapCatalog annotations of DDL of ABAP CDS.

  1. Abapcatalog.buffering.status:
    • It is used to activate and deactivate table buffering for the CDS views.
    • Possible annotation values:
      1. ACTIVATE: Activates table buffering
      2. SWITCHED_OFF: Allows table buffering but not activated
      3. NOT_ALLOWED: Does not allow table buffering
  2. Abapcatalog.buffering.type:
    • It is used to define buffering type in table buffering.
    • Possible annotation values:
      1. SINGLE: Allows us to store single record in buffering area
      2. GENERIC: Stores key fields in buffering area
      3. FULL: Stores all records in buffering area
  3. AbapCatalog.preserveKey:
    • It is used to specify the definition of the key fields in CDS view.
  4. AbapCatalog.sqlViewName:
    • It is used to define name of CDS database view.
  5. Access control annotations:
    • They are used to perform the authorization checks when open SQL tries to access CDS view.
    • Possible annotation values:
      1. CHECK: If CDS role is assigned to the CDS view, access control is performed to check authorizations and throws an error if the role is not found
      2. NOT_REQUIRED: Similar to CHECK but does not throw any error while accessing CDS view
      3. NOT_ALLOWED: Suppresses the authorization checks

ODATA Annotation:

We can expose CDS view as an OData service using below annotation. We don’t need to create any ODATA project in SAP Gateway Service Builder instead we can directly use CDS view.

Possible Annotation Value:

@OData.Publish: true

We have to specified @OData.publish:true at view level to expose CDS views as an OData service. Find the below example for your reference.

Sample code using annotations:


We can develop UI5 applications and ODATA services without UI development knowledge, so that we can reduce the development cost, effort of resources and improving the quality and performance of applications.

Contact for further details

Ramanjaneyulu Senapathi
Team Lead – ERP SAP Technical

0 0 vote
Inline Feedbacks
View all comments