CDS in SAP ABAP: Views, Annotations & Step-by-Step Guide

Introduction to CDS Views in SAP ABAP
As SAP ABAP development continues to be built on HANA technology, it's critical to learn about CDS views in SAP ABAP. This technology allows developers to build rich, semantic data models at the database level. It is a foundational technology that developers must have in their skillset if they wish to pursue careers in SAP ABAP on HANA.
In this guide on CDS views in SAP ABAP, we will address the following topics:
- Overview of Core Data Services
- Core Data Service views in SAP ABAP
- Step-by-step guide to building Core Data Service views
- ABAP Core Data Services annotations
- Core Data Services functions in ABAP
- Core Data Services views in ABAP on HANA
This guide should be beneficial to both new users as well as existing ABAP developers looking to enhance their skillsets.
What is CDS in SAP ABAP?
Core Data Services, or CDS in SAP ABAP, is a set of tools and concepts that SAP has defined as part of the programming model for ABAP on SAP HANA. It allows developers to describe data models, views, and access controls using a declarative SQL-type approach through a language known as ABAP CDS DDL (Data Definition Language).
In contrast to the classic models which rely on ABAP Data Dictionary (SE11 data tables and views) compatible views, CDS views use DDL source code to define views which are designed to be executed on a database engine that has been optimized for SAP HANA.
Why CDS was Implemented
Prior to CDS, all custom business logic and data transformations were done in ABAP application code, causing a major performance bottleneck. CDS moves this logic closer to the database, enabling the use of HANA's in-memory computing for significant performance gain.
Some of the benefits of using CDS with SAP ABAP are:
- Performance: Moves data-related logic to the database
- Reusability: CDS views can be consumed by different applications
- Semantic enrichment: Annotations provide metadata for OData, UI, and analytics
- Integration: Works effortlessly with OData, Fiori, BW/BEx queries
- Standardization: Part of the SAP ABAP RESTful Application Programming Model (RAP)
What Is a CDS View in SAP ABAP?
A CDS view in SAP ABAP is a virtual data model constructed using ABAP CDS DDL syntax. It is layered on top of database tables or other CDS views, and merges and transforms data through SQL-like constructs. Activation of a CDS view creates a SQL view in the SAP HANA database.
Different Kinds of CDS Views
You should be aware of the following CDS entity types:
| Type | Description |
|---|---|
| Basic Interface View | Direct access to the database table; basic representation of raw data |
| Composite Interface View | Integrates multiple basic views or other composite views |
| Consumption View | Optimized for a particular application or UI use case |
| Projection View | Used in RAP; limits the fields consumer can access |
| Value Help View | Provides search help (F4 values) for UI elements |
CDS Views in SAP ABAP on HANA
The integration of CDS views in SAP ABAP on HANA with SAP HANA's in-memory database engine provides the most benefit. Each time a CDS view is created, SAP HANA processes it as a Native SQL View. This means all the joins, aggregations, filters, and calculations happen in-memory for a super-fast response time.
HANA Innovations CDS Views Benefit From
- Code-to-data: Computation is done inside HANA instead of data processing being brought into ABAP
- CDS analytic capabilities: @Analytics annotations allow for analytics queries
- Better execution plans: HANA's larger optimizer benefits from the structure of CDS views in SAP ABAP on HANA
- Less data transfer: Only the expected filtered and aggregated results are passed to the application server
For all the above reasons, CDS views are the basis for the RAP (RESTful ABAP Programming) model, Embedded Analytics, OData services, and SAP Fiori apps.
How to Create a CDS View in SAP ABAP
To be able to create a CDS view, you will need the SAP ABAP Development Tools (ADT). Here is a guide that will show you how to create a CDS view from the beginning to the end.
Prerequisites
- SAP HANA-Based System (e.g. SAP S/4 HANA)
- Eclipse SDK with SAP ABAP Development Tools (ADT) Plugin
- SAP System Development Authorization
Step 1: Create a New ABAP Project in Eclipse
To be able to create a CDS view, you must be able to navigate to your ABAP Project. Also, you need to be able to connect to your ABAP system. Note that CDS views also cannot be developed/created in SE80.
Step 2: Create a New CDS Data Definition
To create a new CDS Data Definition:
- Right click on the desired package in the Project Explorer
- Select New > Other ABAP Repository Object
- Select Core Data Services -> Data Definition
- Then, click Next
Step 3: Input the Details of the CDS View
When you fill the form, here are the things that you must input:
- Name — use something like ZI_SalesOrder (follow the SAP Standard Naming convention. Always use Z or Y to mark anything custom)
- Description — input Sales Order CDS View for example
- Referenced Object — input the database table that will be the base for this view, for example VBAK
After that, click on Next. Then select the transport request and then finish.
Step 4: Write the DDL Source Code
When Eclipse launches the DDL editor, it offers a default template. Take a look at this example for a simple CDS view in SAP ABAP:
@AbapCatalog.viewEnhancementCategory: [#NONE]
@AccessControl.authorizationCheck: #CHECK
@EndUserText.label: 'Sales Order Basic View'
@Metadata.ignorePropagatedAnnotations: true
define view entity ZI_SalesOrder
as select from vbak
{
key vbeln as SalesOrder,
erdat as CreationDate,
auart as OrderType,
kunnr as SoldToParty,
netwr as NetValue,
waerk as Currency
}
Key elements explained:
@AbapCatalog.viewEnhancementCategory: How the view can be enhanced@AccessControl.authorizationCheck: #CHECK: Provides access control via DCL@EndUserText.label: A user-friendly label for the viewdefine view entity: Defines the CDS view entity (modern RAP syntax)as select from vbak: From the VBAK database table the selection is made- Aliases (like
vbeln as SalesOrder) let you name fields better
Step 5: Add Associations (Joins)
CDS views allow associations, a means for defining lazy-loaded joins:
define view entity ZI_SalesOrder
as select from vbak
association [0..1] to vbap as _Items
on $projection.SalesOrder = _Items.vbeln
{
key vbeln as SalesOrder,
erdat as CreationDate,
kunnr as SoldToParty,
/* Association */
_Items
}
Because associations are only resolved on explicit consumption, they promote better performance.
Step 6: Activate the CDS View
Hit Ctrl + F3 or click the Activate button. Once activated successfully, a view will be generated in the HANA database, and a corresponding SQL view will be created in the SAP backend.
Step 7: CDS View Testing
In ADT, you can use the Data Preview (F8) option to see the data, or you can access the view from an ABAP program:
SELECT * FROM zi_salesorder INTO TABLE @DATA(lt_orders).
CDS views can be accessed the same way as ABAP dictionary views using standard Open SQL.
SAP ABAP CDS Annotations
SAP ABAP CDS annotations, which are denoted by an '@' symbol, are used to add additional semantics to the CDS views and can be used by multiple SAP frameworks to automatically create OData services, Fiori UI components, analytics and other capabilities without any additional coding.
Significant CDS Annotations
1. @AbapCatalog Annotations
Control how the view is processed in the ABAP catalog:
@AbapCatalog.viewEnhancementCategory: [#NONE]@AbapCatalog.sqlViewName: 'ZSALESORDER'
2. @AccessControl Annotations
Control authorization checks:
@AccessControl.authorizationCheck: #CHECK
3. @EndUserText Annotations
Provide labels and descriptions for user interfaces:
@EndUserText.label: 'Sales Order'@EndUserText.quickInfo: 'Displays sales order header data'
4. @Analytics Annotations
Make the view available for embedded analytics and BW extraction:
@Analytics.dataCategory: #CUBE@Analytics.dataExtraction.enabled: true
5. @OData Annotations
Allow automatic generation of OData services:
@OData.entitySet.name: 'SalesOrders'@OData.publish: true
6. @UI Annotations
Control the rendering of the Fiori user interface, including list items, headers, and facets:
@UI.lineItem: [{ position: 10, label: 'Sales Order' }]
@UI.selectionField: [{ position: 10 }]
@UI.headerInfo.typeName: 'Sales Order'
7. @VDM (Virtual Data Model) Annotations
Categorize views in the SAP VDM hierarchy:
@VDM.viewType: #BASIC
SAP ABAP CDS annotations are what make views "smart" — basically, they convert raw SQL views into rich, user-friendly, and semantically correct data services.
CDS Functions in SAP ABAP
CDS functions in SAP ABAP are SQL functions that are built in for use within the CDS DDL for transforming and calculating field values. They are akin to SQL functions but are defined inside the CDS ecosystem.
CDS Functions Classification
1. Functions of Numeric Data Types
abs(amount) -- Absolute valueceil(price) -- Ceiling
floor(price) -- Floor
div(a, b) -- Integer division
mod(a, b) -- Modulo
2. Functions of String Data Types
concat(firstname, lastname) -- Concatenation of stringsleft(name, 5) -- Left substring of length 5
right(name, 3) -- Right substring of length 3
length(description) -- Length of string
upper(name) -- Convert string to uppercase
lower(email) -- Convert string to lowercase
ltrim(name) -- Left trim whitespace
rtrim(name) -- Right trim whitespace
replace(name, 'old', 'new') -- Replace part of string with new substring
3. Functions of Date Data Types
dats_days_between(date1, date2) -- Number of days between two datesdats_add_days(date, 30) -- Add 30 days to date
dats_is_valid(date) -- Validate date
tstmp_to_dats(timestamp, ...) -- Convert timestamp to date
4. Functions of Type Conversion
cast(amount as abap.dec(15,2)) -- Conversion to specific type
5. Functions of Conditional Logic
case statuswhen 'A' then 'Active'
when 'I' then 'Inactive'
else 'Unknown'
end as StatusText
6. Functions of Aggregation
Usage in CDS views in SAP ABAP with GROUP BY:
sum(netvalue) as TotalNetValue,count(*) as OrderCount,
avg(netvalue) as AvgNetValue,
max(netvalue) as MaxNetValue,
min(netvalue) as MinNetValue
7. Functions of Currency and Unit Conversion
currency_conversion(amount => amount,
source_currency => currency,
target_currency => 'USD',
exchange_rate_date => $session.system_date
) as AmountInUSD
These built-in CDS functions in SAP ABAP eliminate the need for ABAP post-processing and concentrate all computation in the HANA layer.
CDS Views Recommendations
To achieve maximum effectiveness in your CDS views in SAP ABAP, apply the following recommendations:
- VDM layering: Use basic, composite, and consumption views
- Use good aliases: Change technical field names to more user-friendly names as needed
- Access control: Use
@AccessControl.authorizationCheck: #CHECKin productive systems - Join optimization: Opt to use associations instead of joins
- Annotation coverage: Use
@EndUserText,@UI, and@VDMannotations for coverage - CDS View Reusability: Use existing CDS views instead of creating new ones
- Data Preview Testing: Use the Data Preview in ADT (F8) to test CDS output
- RAP Projection Views: Use projection views to expose data through the RAP model
Career Prospects with CDS in SAP ABAP
Having expertise in CDS views in SAP ABAP gives you a multitude of options in your career:
- SAP ABAP Developer (S/4HANA) — Developing with ABAP and S/4HANA requires use of CDS
- SAP Fiori Developer — Developing Fiori requires an understanding of CDS and OData
- SAP BTP Developer — Developing for BTP is almost exclusively done with CDS and RAP
- SAP Analytics Developer — Developing for Embedded Analytics and BW relies on CDS
- SAP Technical Architect — Building data models for HANA requires knowledge of CDS
With expertise in SAP ABAP development with CDS, developers in India can expect to earn ₹8–25 LPA, while those in the US can earn $90,000–$140,000 based on their expertise and knowledge.
Conclusion
The potential of CDS in SAP ABAP is unrivaled in SAP development. CDS views streamline the entire process of constructing SAP Fiori Apps, OData services, and embedded analytics. They go as far as creating virtual data models.
We focused on the following in this CDS view in SAP ABAP tutorial:
- The definition of CDS in SAP ABAP and the reasons behind its conception
- The workings of CDS views and SAP HANA
- How to create CDS views in SAP ABAP articulated in clear steps
- The practical usage of SAP ABAP CDS annotations
- The transforming data capabilities of CDS functions in SAP ABAP
- Career advice and best practices
Furthering your knowledge of SAP ABAP development is going to require enrolling in a formal course on CDS views, RAP, and Fiori development. These subjects are integrated into SAP ABAP on HANA. Start with the easier modules, then move on to constructing CDS views in a sandbox system, and finally to creating OData services and Fiori applications.
Our experts have designed online courses in SAP ABAP, Fiori Development, RAP, and CDS Views to provide learners with the skills that the industry needs. Start your SAP ABAP journey with us today.
Related SAP Training Courses
Tags
Share this article
Help others discover this valuable SAP content
Related Articles

SAP Fiori Apps Library: What is SAP Fiori, Apps & Launchpad
Complete guide on SAP Fiori apps library covering what is Fiori apps, SAP UI5, launchpad and login. Learn SAP Fiori from basics to advanced concepts easily.

SAP CPI iFlow explained: types, design patterns, and real-world examples
Learn what an iFlow is in SAP CPI, how it fits into SAP Integration Suite, key component types, proven design patterns, and real-world implementation examples.

SAP CPI Career Path in 2026 – Salary, Scope & Opportunities
Explore the SAP CPI career path in 2026. Discover salary trends for freshers & experienced pros, job scope, certifications, and global opportunities.