Data & Services

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 ▾
Where it sits: L5 · Business logic & data modelLayer: Business logic & data model.L1L2L3L4L5L6BTP

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:

  1. A developer creates a data definition in ABAP Development Tools and writes a DEFINE VIEW ENTITY statement: data sources, selected fields, calculations, joins and associations to other CDS entities.
  2. Annotations add metadata: labels, semantics such as currency or unit fields, analytics roles, UI hints and OData exposure settings.
  3. On activation, the system creates the CDS entity and the corresponding view on the database, so the logic runs where the data sits.
  4. Consumers read the view: ABAP SQL in programs, OData services built with RAP, analytical queries and released APIs.
  5. 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 entityCDS DDIC-based view
StatementDEFINE VIEW ENTITYDEFINE VIEW with an SQL view name
Extra ABAP Dictionary viewNoneA CDS-managed DDIC view is generated
Available on-premiseABAP 7.55 (SAP S/4HANA 2020)ABAP 7.40 SP05
Available in the cloudSAP BTP ABAP environment and Public Edition 2005Not recommended; use view entities
StatusRecommendedObsolete: 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:

  1. 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.
  2. SAP Fiori elements reads the UI annotations from that service and renders a list report or object page.
  3. Analytical apps consume CDS analytical queries, defined as transient view entities in recent releases and with the deprecated @Analytics.query annotation 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?

  1. Creating new DDIC-based views. They are obsolete; start with view entities.
  2. Building on unreleased SAP views. It works until an upgrade changes the view. Check the release contract first.
  3. 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.
  4. Writing UI annotations into the data definition. Metadata extensions keep the model readable and let UI metadata change on its own schedule.
  5. 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 CDSCAP CDS
Runs inThe ABAP platform (SAP S/4HANA, SAP BTP ABAP environment)CAP Node.js or Java runtime, mainly on SAP BTP
BecomesDatabase views managed by the ABAP repositoryDatabase tables and views plus service definitions, generated by the CAP compiler
Transactional behaviorAdded with RAP behavior definitionsGeneric CAP handlers plus custom code
LifecycleABAP transportsProject builds and deployments (for example, multi-target applications)
Typical useData models inside SAP S/4HANA and ABAP extensionsSide-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

Applies to
SAP S/4HANA on-premise · SAP S/4HANA Cloud Private Edition · SAP S/4HANA Cloud Public Edition
Last reviewed

SAP, SAP Fiori, SAPUI5, SAP S/4HANA, SAP BTP and other SAP products and services mentioned are trademarks or registered trademarks of SAP SE (or an SAP affiliate company) in Germany and other countries. This guide is independent and is not affiliated with, sponsored or endorsed by SAP SE.