ABAP CDS Views
ABAP CDS views are data models defined with Core Data Services, the SQL-based data definition language of the ABAP platform. A CDS view declares fields, joins, associations to other entities and annotations, and the database executes it. In SAP S/4HANA, CDS views form the virtual data model behind many SAP Fiori apps, analytics and APIs.
Quick facts
- Type
- ABAP repository object (data definition, DDLS)
- Layer
- Business logic & data model
- Edited in
- ABAP Development Tools (Eclipse)
- Current variant
- CDS view entities (DEFINE VIEW ENTITY), on-premise as of ABAP 7.55 / SAP S/4HANA 2020
- Obsolete variant
- CDS DDIC-based views (DEFINE VIEW), available since ABAP 7.40 SP05
- Who works with it
- ABAP developers, analytics modelers, key users (Custom CDS Views app)
- Applies to
- SAP S/4HANA (all deployment options); also SAP BTP ABAP environment
Layer: Business logic & data modelWhere it sits ▾
Layer: Business logic & data model
Open the architecture map →How does an ABAP CDS view work?
An ABAP CDS view is source code that the ABAP system turns into a database view:
- A developer creates a data definition in ABAP Development Tools and writes a
DEFINE VIEW ENTITYstatement: data sources, selected fields, calculations, joins and associations to other CDS entities. - Annotations add metadata: labels, semantics such as currency or unit fields, analytics roles, UI hints and OData exposure settings.
- On activation, the system creates the CDS entity and the corresponding view on the database, so the logic runs where the data sits.
- Consumers read the view: ABAP SQL in programs, OData services built with RAP, analytical queries and released APIs.
- If a CDS access control exists for the view, its conditions are applied to every read of the view.
Associations are a key difference from classic database views: they declare a relationship once, and the join is only built when a consumer follows the association path. An ABAP CDS view is therefore a reusable semantic data model, not just a stored SELECT.
What is the difference between CDS view entities and DDIC-based views?
| CDS view entity | CDS DDIC-based view | |
|---|---|---|
| Statement | DEFINE VIEW ENTITY | DEFINE VIEW with an SQL view name |
| Extra ABAP Dictionary view | None | A CDS-managed DDIC view is generated |
| Available on-premise | ABAP 7.55 (SAP S/4HANA 2020) | ABAP 7.40 SP05 |
| Available in the cloud | SAP BTP ABAP environment and Public Edition 2005 | Not recommended; use view entities |
| Status | Recommended | Obsolete: still possible, not recommended |
SAP's documentation lists faster activation, simpler syntax and stricter checks among the reasons for view entities. Existing DDIC-based views keep working, and ABAP Development Tools offers a migration wizard, documented on-premise as of SAP S/4HANA 2023 FPS00. RAP in strict mode also expects view entities as data sources. For any new development, view entities are the variant of ABAP CDS views to use.
How do CDS views fit into the virtual data model?
SAP S/4HANA ships thousands of CDS views organized as the virtual data model (VDM). Basic interface views expose business entities close to the tables, composite interface views combine them, and consumption views serve a specific app or query. The name prefix signals the layer: I_ for interface views, such as I_SalesOrder, and C_ for consumption views.
What matters for customers is the release status of a view:
- Released for key user extensibility (contract C1): usable in key user tools such as the Custom CDS Views app.
- Released for cloud development (contract C1): usable by developers in ABAP Cloud, including developer extensibility.
- Not released: visible in the system but without a stability contract; SAP may change it in any upgrade.
A key user at Alder Manufacturing who needs open purchase orders by supplier, for example, builds a custom CDS view on released purchasing views instead of reading tables. In the virtual data model, the release status decides whether building on an ABAP CDS view is safe.
How do ABAP CDS views become SAP Fiori apps?
A CDS view supplies data and metadata; other objects turn it into an app:
- Current path (RAP): CDS view entities form a business object, a behavior definition adds operations, projection views tailor it, and a service definition plus a service binding expose it as OData V2 or V4.
- SAP Fiori elements reads the UI annotations from that service and renders a list report or object page.
- Analytical apps consume CDS analytical queries, defined as transient view entities in recent releases and with the deprecated
@Analytics.queryannotation in older ones.
Older systems use earlier paths: the @OData.publish annotation of the ABAP Programming Model for SAP Fiori, or an SAP Gateway project that uses the CDS view as a referenced data source; check which of them your release still supports. In every path, the ABAP CDS view defines what the data is; transactional behavior comes from RAP or, in the predecessor model, from BOPF.
Where do ABAP CDS views stop?
The strengths are substantial. One model serves OData, analytics and ABAP SQL alike; calculations run in the database; annotations carry semantics that every consumer understands; and access control is declared next to the data.
The limits follow from what a view is:
- Read model only. A CDS view does not create, change or validate data. Transactions need a RAP business object on top.
- Declarative SQL, not procedural logic. Complex algorithms move to CDS table functions implemented in AMDP, or to ABAP.
- Performance depends on the stack. Views built on views on views can produce heavy SQL; associations used carelessly multiply joins.
- Release-bound. Syntax features arrive release by release; a view written for the SAP BTP ABAP environment may not activate on an older on-premise release.
ABAP CDS views are the right place for data semantics, not for process or transaction logic.
What are common mistakes with ABAP CDS views?
- Creating new DDIC-based views. They are obsolete; start with view entities.
- Building on unreleased SAP views. It works until an upgrade changes the view. Check the release contract first.
- Forgetting access control. Without a CDS access control, anyone authorized to read the view sees all of its data. Add an access control and keep app start authorizations as well.
- Writing UI annotations into the data definition. Metadata extensions keep the model readable and let UI metadata change on its own schedule.
- Confusing ABAP CDS with CAP CDS. Same idea and similar syntax, different runtime: a CAP model does not activate in an ABAP system.
Most problems with ABAP CDS views come from lifecycle decisions, not from SQL.
ABAP CDS vs. CAP CDS: what is the difference?
| ABAP CDS | CAP CDS | |
|---|---|---|
| Runs in | The ABAP platform (SAP S/4HANA, SAP BTP ABAP environment) | CAP Node.js or Java runtime, mainly on SAP BTP |
| Becomes | Database views managed by the ABAP repository | Database tables and views plus service definitions, generated by the CAP compiler |
| Transactional behavior | Added with RAP behavior definitions | Generic CAP handlers plus custom code |
| Lifecycle | ABAP transports | Project builds and deployments (for example, multi-target applications) |
| Typical use | Data models inside SAP S/4HANA and ABAP extensions | Side-by-side applications and services on SAP BTP |
ABAP CDS and CAP CDS share a modeling idea and a name, but they are separate languages with separate compilers and runtimes.
FAQ
Are CDS DDIC-based views still supported?
Existing CDS DDIC-based views keep working, but SAP classifies them as obsolete and recommends CDS view entities for new development. ABAP Development Tools also offers a wizard to migrate DDIC-based views to view entities, documented as supported as of SAP S/4HANA 2023 FPS00.
Can ABAP CDS views be used in SAP ECC?
CDS DDIC-based views exist as of ABAP 7.40 SP05, so SAP ERP systems on a sufficiently recent SAP NetWeaver release can use them. CDS view entities require ABAP 7.55, the release of SAP S/4HANA 2020, so check the SAP NetWeaver release of the SAP ERP system before planning them.
Can key users create CDS views without ABAP development?
Yes. The Custom CDS Views app lets key users build custom views on top of SAP CDS views that are released for key user extensibility. The result can serve as a cube or dimension view for analytics or be exposed as an external OData API, within the limits of the released views.
Do ABAP CDS views replace SAP HANA calculation views?
Not in general. ABAP CDS views are ABAP repository objects with ABAP lifecycle and authorization concepts. SAP HANA calculation views are native database models. In SAP S/4HANA, application data models are built in ABAP CDS.
How do I find the CDS view behind a SAP Fiori app?
Start from the app's OData service in the SAP Fiori apps reference library, then open the service definition or the service in ABAP Development Tools to see the exposed CDS entities. The View Browser app helps explore released views by name and description.
Sources
- SAP Help Portal: ABAP CDS — Feature Tables (release availability of CDS language elements)
- SAP Help Portal: ABAP CDS — DDIC-Based Entities (Obsolete)
- SAP Help Portal: CDS View Entities compared with CDS DDIC-based views (ABAP platform)
- SAP Help Portal: Stability Contract for System-Internal Use (C1), SAP S/4HANA
- SAP Help Portal: Virtual Data Model — view types and layers (SAP S/4HANA)
- Applies to
- SAP S/4HANA on-premise · SAP S/4HANA Cloud Private Edition · SAP S/4HANA Cloud Public Edition
- Last reviewed