CDS Views — Modern Data Modeling in SAP (2026 Guide)

CDS Views in SAP: Modern Data Modeling Guide 2026 | ABAP Zero to Hero
ABAP Zero to Hero

Chapter 16  ·  Modern ABAP

CDS Views — Modern Data Modeling

How to define reusable, semantic data models in ABAP that push logic to HANA and power RAP, Fiori, and OData services.

Chapter 16 of 20 20 min read Part 4: Modern ABAP 10 Interview Q&A

Up to now, you have been reading from tables directly. SELECT from VBAK, SELECT from KNA1, join, process, display. That works — for reports. But modern SAP development does not work that way.

In S/4HANA, RAP, Fiori, and OData, data is not read from tables. It is read from CDS Views — Core Data Services Views. These are semantic data models that live in the database, describe business meaning, and can be consumed by both ABAP code and external systems like Fiori apps.

This is the chapter where you cross from classic ABAP into the modern world. From here on, everything you build — RAP business objects, Fiori apps, analytics — sits on top of CDS Views.

The shift in thinking In classic ABAP, you read data. In modern ABAP, you model data. A CDS View is not just a SELECT statement — it is a definition of what the data means, how it relates to other data, and who is allowed to see it.

🎯 What You Will Learn in This Chapter

  • What CDS Views are and why they matter in S/4HANA
  • The difference between CDS Views and SE11 Views
  • How to create a CDS View in Eclipse ADT
  • The main annotation families and what they control
  • What Associations are and how they differ from JOINs
  • How to create Parameterized CDS Views
  • What Access Control (DCL) is and how it enforces row-level security
  • How to consume CDS Views in ABAP with Open SQL
  • The difference between classic CDS View and modern CDS View Entity

📘 What is a CDS View?

CDS stands for Core Data Services. A CDS View is a data model definition written in SQL-like syntax that is compiled and executed directly on the SAP HANA database.

Think of it as a supercharged SQL view. It does everything a normal view does — selects, joins, filters — but adds:

  • Calculations — arithmetic, string operations, case expressions
  • Aggregations — SUM, AVG, COUNT, MIN, MAX
  • Annotations — metadata that controls authorization, UI rendering, OData exposure
  • Associations — declared relationships to other views
  • Parameters — input values that filter the result at query time
  • Semantics — built-in meaning for amounts, currencies, units, dates
The one-line definition A CDS View is a reusable, semantic data model that lives on the database and can be consumed by ABAP, RAP, Fiori, OData, and analytics — all from the same definition.

⚖️ CDS View vs SE11 View — Why the Change?

You already learned about SE11 Views in Chapter 5. Why do we need something else?

FeatureSE11 ViewCDS View
Where definedSE11 (Data Dictionary)Eclipse ADT
SyntaxGraphical (no code)SQL-like code
CalculationsNoYes
AggregationsNoYes
AssociationsNo (only JOINs)Yes
ParametersNoYes
AnnotationsNoYes
Row-level auth (DCL)NoYes
Pushes logic to HANAPartialFull
Consumable by RAP / FioriNoYes
Modern standardLegacy✅ Standard
The takeaway SE11 Views were designed when the database was slow and the application server did the work. CDS Views were designed for HANA, where the database is fast and semantics matter.

🛠 Creating Your First CDS View

CDS Views are created in Eclipse ADT, not in SAP GUI.

1 Open your ABAP package

In Eclipse ADT, right-click your package. Choose New → Other ABAP Repository Object → Core Data Services → Data Definition.

2 Name your view

Use the naming convention: ZI_ for interface views, ZC_ for consumption views. Example: ZI_TRAVEL. Description: “Travel interface view”.

3 Choose a template

Select “Define View” (classic syntax) or “Define View Entity” (modern). For S/4HANA 2020+, prefer Define View Entity.

4 Write the view definition

Fill in the template with your data source, fields, and annotations.

A minimal CDS View

@AbapCatalog.sqlViewName: 'ZITRAVEL'
@AbapCatalog.compiler.compareFilter: true
@AccessControl.authorizationCheck: #CHECK
@EndUserText.label: 'Travel Interface View'

define view ZI_Travel
  as select from /dmo/travel as Travel
{
  key Travel.travel_id       as TravelId,
      Travel.agency_id       as AgencyId,
      Travel.customer_id     as CustomerId,
      Travel.begin_date      as BeginDate,
      Travel.end_date        as EndDate,
      Travel.booking_fee     as BookingFee,
      Travel.total_price     as TotalPrice,
      Travel.currency_code   as CurrencyCode,
      Travel.status          as Status
}

A modern CDS View Entity (ABAP 7.55+)

@AccessControl.authorizationCheck: #CHECK
@EndUserText.label: 'Travel Interface View'

define view entity ZI_Travel
  as select from /dmo/travel as Travel
{
  key Travel.travel_id       as TravelId,
      Travel.agency_id       as AgencyId,
      Travel.customer_id     as CustomerId,
      Travel.begin_date      as BeginDate,
      Travel.end_date        as EndDate,
      Travel.booking_fee     as BookingFee,
      Travel.total_price     as TotalPrice,
      Travel.currency_code   as CurrencyCode,
      Travel.status          as Status
}
View vs View Entity The classic define view needs a separate SQL view name via @AbapCatalog.sqlViewName. The modern define view entity does not — it maps directly to the database. In ABAP Cloud and S/4HANA 2020+, always use define view entity.

🏷️ Annotations — The Metadata Layer

Annotations are declarations prefixed with @ that add meaning and behavior to a CDS View. They are what turns a plain data model into a semantic, service-ready definition.

The main annotation families

AnnotationWhat It ControlsExample
@AbapCatalogTechnical properties (SQL view name, buffering)@AbapCatalog.sqlViewName: 'ZI...'
@AccessControlAuthorization behavior (DCL checks)@AccessControl.authorizationCheck: #CHECK
@EndUserTextLabels for fields and views@EndUserText.label: 'Travel ID'
@SemanticsMeaning of fields (amounts, currencies, dates)@Semantics.amount.currencyCode: 'CurrencyCode'
@UIUI rendering in Fiori (lineItem, selectionField, identification)@UI.lineItem: [{ position: 10 }]
@ODataOData service publishing@OData.publish: true
@AnalyticsAnalytical queries and dimensions@Analytics.dataCategory: #CUBE
@SearchSearch behavior (fuzzy search, ranking)@Search.searchable: true

Practical example — a consumption view

@AccessControl.authorizationCheck: #CHECK
@EndUserText.label: 'Travel Consumption View'
@UI.headerInfo: { typeName: 'Travel', typeNamePlural: 'Travels' }
@Metadata.allowExtensions: true

define view entity ZC_Travel
  as select from ZI_Travel
{
  @UI.lineItem: [{ position: 10 }]
  @UI.identification: [{ position: 10 }]
  key TravelId,

  @UI.lineItem: [{ position: 20 }]
  @UI.selectionField: [{ position: 20 }]
      AgencyId,

  @UI.lineItem: [{ position: 30 }]
      CustomerId,

  @UI.lineItem: [{ position: 40 }]
      BeginDate,

  @UI.lineItem: [{ position: 50 }]
      EndDate,

  @UI.lineItem: [{ position: 60 }]
  @Semantics.amount.currencyCode: 'CurrencyCode'
      TotalPrice,

      @Semantics.currencyCode: true
      CurrencyCode
}
Annotations in one sentence Annotations are how a CDS View tells the outside world (Fiori, OData, analytics) what it means and how to present it — without any ABAP code.

🔗 Associations — Lazy Joins

An Association is a declared relationship between two CDS Views or between a CDS View and a table. It is like a JOIN — but better.

JOIN vs Association

AspectJOINAssociation
When executedImmediatelyOnly when used
Data volumeFull merge of all rowsOnly the rows requested
DeclarationIn the SELECT clauseIn the view definition
ReusabilityPer queryPer view — reused everywhere
NavigationNoYes (path expressions)
Used by RAP / ODataNoYes

Defining an Association

@AccessControl.authorizationCheck: #CHECK
@EndUserText.label: 'Travel with Customer'

define view entity ZI_TravelWithCustomer
  as select from /dmo/travel as Travel
  association [0..1] to /dmo/customer as _Customer
    on Travel.customer_id = _Customer.customer_id
{
  key Travel.travel_id       as TravelId,
      Travel.customer_id     as CustomerId,
      Travel.total_price     as TotalPrice,

      // Expose the association
      _Customer
}

Using the Association in a path expression

@EndUserText.label: 'Travel with customer name'

define view entity ZI_TravelWithName
  as select from ZI_TravelWithCustomer
{
  key TravelId,
      CustomerId,

      // Path expression — navigates the association
      _Customer.first_name   as CustomerFirstName,
      _Customer.last_name    as CustomerLastName,

      TotalPrice
}
Why associations win A query that only needs TravelId and TotalPrice does not touch the customer data. A query that needs the customer name navigates the association only for the requested rows. The database reads exactly what is needed — nothing more.

🎛️ Parameterized CDS Views

A CDS View can accept input parameters that are supplied at query time. This lets one view serve many scenarios — different dates, currencies, or scopes — without duplicating the model.

@AccessControl.authorizationCheck: #CHECK
@EndUserText.label: 'Travel by date range'

define view entity ZI_TravelByDate
  with parameters
    P_FromDate : abap.dats,
    P_ToDate   : abap.dats
  as select from /dmo/travel as Travel
{
  key Travel.travel_id       as TravelId,
      Travel.customer_id     as CustomerId,
      Travel.begin_date      as BeginDate,
      Travel.end_date        as EndDate
}
where Travel.begin_date >= :P_FromDate
  and Travel.end_date   <= :P_ToDate
Why parameters matter Parameters make CDS Views reusable. One view for “travel by date range” serves every date filter you will ever need — no code duplication, no view proliferation.

🔒 Access Control (DCL) — Row-Level Security

A CDS View can be protected by a DCL (Data Control Language) file that defines row-level authorization. This means different users see different rows of the same view, based on their authorization roles.

The annotation that turns it on

@AccessControl.authorizationCheck: #CHECK

A simple DCL file

@EndUserText.label: 'Authorization for ZI_Travel'
@MappingRole: true

define role ZI_Travel {
  grant select on ZI_Travel

  where ( Travel.agency_id ) =
        aspect pfcg_auth ( S_AGENCY, ACTVT = '03' );
}

What this means: a user only sees rows where the agency_id matches what they are authorized for in their role (transaction PFCG).

The big shift In classic ABAP, authorization checks were scattered throughout your code with AUTHORITY-CHECK statements. With DCL, authorization is defined once at the data layer. Every consumer — ABAP, RAP, Fiori, OData — gets the same enforcement automatically.

📥 Consuming CDS Views in ABAP

Once a CDS View is created and activated, you consume it in ABAP just like a table:

" Read from a CDS View like a table
SELECT * FROM ZI_Travel
  INTO TABLE @DATA(lt_travel)
  WHERE CustomerId = @lv_customer_id.

LOOP AT lt_travel INTO DATA(ls_travel).
  WRITE: / ls_travel-TravelId, ls_travel-TotalPrice.
ENDLOOP.

" For parameterized views, use a WITH clause
SELECT * FROM ZI_TravelByDate(
    P_FromDate = @lv_from,
    P_ToDate   = @lv_to
  ) INTO TABLE @DATA(lt_travel_range).
What just happened Your ABAP code did not do any joins, filters, or calculations. All the heavy lifting happened in HANA. This is Code Pushdown — the same idea from Chapter 15, but now formalized into a reusable model.

📝 Chapter Summary

  • CDS Views are semantic data models defined in ABAP and executed on the HANA database.
  • They replace SE11 Views for modern development — supporting calculations, annotations, associations, parameters, and DCL.
  • Two syntaxes: define view (classic) and define view entity (modern, recommended).
  • Annotations add meaning and behavior: @AccessControl, @UI, @Semantics, @OData, etc.
  • Associations are lazy joins — declared once, executed only when used via path expressions.
  • Parameters make views reusable across scenarios.
  • DCL enforces row-level authorization once, for all consumers.
  • Consume CDS Views in ABAP with SELECT ... FROM ZI_..., just like a table.
  • Everything modern — RAP, Fiori, OData, Analytics — sits on top of CDS Views.

🎤 Interview Questions & Answers

CDS Views are the single most-tested modern ABAP topic. Almost every S/4HANA or cloud project interview will include these questions.

1 What is a CDS View in SAP?

A CDS View (Core Data Services View) is a data model definition written in SQL-like syntax that runs directly on the SAP HANA database. It combines tables, joins, calculations, and annotations in a single declarative definition. CDS Views push logic down to the database and expose semantically rich data models for RAP, Fiori, and OData services.

2 How is a CDS View different from a SE11 View?

SE11 views (Database Views, Projection Views, Maintenance Views, Help Views) are classic SAP views created in the Data Dictionary. They are limited to joins and projections, cannot include calculations or annotations, and are not optimized for HANA. CDS Views support calculations, aggregations, associations, annotations, parameters, and Code Pushdown, and they are the modern standard for S/4HANA.

3 What are annotations in CDS?

Annotations are metadata declarations prefixed with @ that add behavior and semantics to a CDS View. Examples: @AccessControl.authorizationCheck, @EndUserText.label, @UI.lineItem, @Semantics.amount.currencyCode. Annotations control authorization, semantics, UI rendering, OData exposure, and more.

4 What is an Association in CDS?

An Association is a predefined relationship between two CDS Views or between a CDS View and a table. Unlike a JOIN, an Association is not executed at runtime unless it is exposed or used in a path expression. Associations enable lazy loading, reduce data volume, and are used by RAP and OData to navigate between entities.

5 What is the difference between JOIN and Association?

A JOIN combines data from two sources immediately and returns a merged result set. An Association defines a relationship between two sources but does not execute until the association is used in a path expression or exposed for navigation. Associations are more performant because the join is only performed when needed.

6 What are the different types of CDS Views?

Common CDS View types: Basic Interface View (data foundation), Composite Interface View (business logic), Consumption View (UI, OData, Analytics), and View Entity (in ABAP Cloud via ADT). Each type has a specific purpose — interface views focus on reusable semantics, consumption views focus on end-user scenarios.

7 What is a Parameterized CDS View?

A Parameterized CDS View accepts input parameters that are supplied when the view is queried. Parameters are declared using a colon syntax (e.g., P_DATE : abap.dats). They allow filtering at query time without changing the view definition, and are commonly used for date-range reports, currency conversions, and dynamic authorizations.

8 What is the difference between CDS View and CDS View Entity?

A CDS View is the classic syntax defined using @AbapCatalog.sqlViewName annotation, which requires a separate SQL view in the database. A CDS View Entity is the modern syntax (introduced in ABAP 7.55) that maps directly to the database without a separate SQL view. View Entities are the recommended syntax in ABAP Cloud and S/4HANA 2020+.

9 What is @AccessControl?

The @AccessControl annotation family defines how authorization is enforced when a CDS View is queried. @AccessControl.authorizationCheck controls whether the view requires an access control definition, and DCL (Data Control Language) files provide row-level authorization logic. This ensures users only see the data they are authorized to see.

10 How do you consume a CDS View in ABAP?

You consume a CDS View in ABAP by using a SELECT statement against the CDS View name (not the SQL view name). For example: SELECT * FROM ZI_MyView INTO TABLE @DATA(lt_result). The CDS View is treated like a database table in ABAP, and the access happens via the ABAP SQL engine, which passes the query to the HANA database optimized.

🛠 Practice Task for This Chapter

Build three CDS Views that chain together. This is the standard pattern for real SAP projects.

  1. Create a Basic Interface View: Create ZI_Travel that reads from /DMO/TRAVEL and exposes TravelId, CustomerId, TotalPrice, CurrencyCode, and Status.
  2. Add an Association: Create ZI_TravelWithCustomer that includes the fields from ZI_Travel plus an association to /DMO/CUSTOMER. Expose the association.
  3. Create a Consumption View: Create ZC_Travel that reads from ZI_TravelWithCustomer, exposes the customer name via the association, and adds @UI.lineItem annotations to make it Fiori-ready.
  4. Preview the data: Right-click each CDS View in ADT and choose Open With → Data Preview. Verify the data appears as expected.
  5. Consume in ABAP: Write a small ABAP report that selects from ZC_Travel and displays the results in an ALV report.
  6. Add a Parameter (bonus): Create ZI_TravelByDate with parameters P_FromDate and P_ToDate, and filter by date range.
Why this matters This layered approach — Basic → Composite → Consumption — is the standard CDS View pattern in S/4HANA. Every RAP business object and every Fiori app follows this structure. Practice it now and it will feel natural by the time you reach Chapter 17.
🎯 Chapter 16 Challenge

Test: Kon Banega Crorepati?

5 questions. ₹1 Crore. Prove you understood CDS Views. No pressure — restart anytime.

₹1,000 ₹10,000 ₹1,00,000 ₹10,00,000 ₹1 Crore
Question 1 of 5
Score: 0
Q1
🏆
You Did It!
0/5Correct Answers
You won ₹0
➡️ Next Chapter

➡️ Next Chapter

You can now model data with CDS Views. In Chapter 17, you will use them to build a complete RAP business object — the modern standard for transactional SAP apps.

Chapter 17 RAP — Building a Business Object →
Want to Learn Faster?

Explore Our Instructor-Led SAP & IT Courses

Self-study works. But if you want guided training, real project practice, and placement support — here are the courses we offer. Book a free demo before you decide.

WhatsApp WhatsApp us
Call Now Button