CDS views
CDS (Core Data Services) views are the modern, code-pushdown way to define data models and analytics in ABAP, executed on the HANA database. CDS is central to S/4HANA development, Fiori and analytics, and a must-learn for modern ABAP.
CDS is the data-modelling foundation of the modern ABAP RESTful Application Programming model (RAP), the standard for building Fiori apps and services in S/4HANA.
- CDS views are defined in ABAP (as source objects) but run as views on the HANA database, embodying the "code-to-data" principle…
- CDS annotations add meaning and behaviour, expose a view as an OData service for Fiori (@OData.
- CDS is central to S/4HANA development, Fiori and analytics, and a must-learn for modern ABAP.
- Watch out: Pulling data into ABAP instead of modelling in CDS.
What CDS is
CDS views are defined in ABAP (as source objects) but run as views on the HANA database, embodying the "code-to-data" principle: instead of pulling rows into ABAP and processing them, you define rich, reusable views (with joins, aggregations, associations and annotations) that the database computes. CDS underpins S/4HANA’s data model, embedded analytics and OData/Fiori.
A simple CDS view
@AbapCatalog.sqlViewName: 'ZVSALESSUM'
@AccessControl.authorizationCheck: #CHECK
define view Z_Sales_Summary as select from vbak
association [1..*] to vbap as _Items on vbak.vbeln = _Items.vbeln
{
key vbak.vbeln,
vbak.kunnr,
sum( _Items.netwr ) as TotalValue
} group by vbak.vbeln, vbak.kunnrAnnotations make CDS powerful
CDS annotations add meaning and behaviour, expose a view as an OData service for Fiori (@OData.publish), mark analytics semantics, define UI hints, and enforce authorization. This is how one CDS view can drive a Fiori app, an analytical query and an API.
CDS and RAP
CDS is the data-modelling foundation of the modern ABAP RESTful Application Programming model (RAP), the standard for building Fiori apps and services in S/4HANA. Learning CDS is the entry point to modern, cloud-ready ABAP development.
Common pitfalls
- Pulling data into ABAP instead of modelling in CDS.
- Ignoring annotations that unlock OData/analytics.
- Over-complex single views instead of layered, reusable ones.