CDS Views
CDS Views Part 1: What a CDS View Entity Is and Why It Matters
Understand what a CDS view entity is, how it differs from a classic DDIC-based CDS view, which layers (VDM) it lives in, and how ABAP, RAP, OData and analytics all consume the same model.
A finance team had five custom ABAP reports that each selected sales orders from tables, joined customers and calculated the order age and status text in ABAP loops. The logic differed slightly between reports, so the numbers never matched, and one report took 12 minutes because it read all orders into ABAP before filtering. The team built one interface view ZI_SalesOrder with the status text, age calculation and customer association, and a consumption view per report. The reports became simple SELECTs with WHERE clauses that run on HANA. Runtime of the slowest report dropped to seconds, all reports showed identical figures, and the same view was later reused for a Fiori app without rewriting the logic.
CDS Views Part 2: Create Your First CDS View Entity in ADT
Create a real ABAP CDS view entity in ADT with keys, aliases, currency semantics and a simple association, then activate and preview the result.
Model a purchase requisition summary entity exposing requisition number, item, material, plant, quantity and unit from a supported source, then consume it in a higher projection.
CDS Views Part 3: Performance — Joins, Associations, Filters and Aggregation
Make CDS views fast: understand how associations and path expressions turn into joins, why to-many paths multiply rows, how to push filters and aggregation to the database, and how to analyze a slow view.
A Fiori list of open sales orders took 40 seconds and showed some orders several times. The consumption view contained "_Item.Material" and "_Item.NetAmount" in its element list to show "a material" and "an amount" per order. Both were to-many paths: each order was returned once per item, and the list then deduplicated in the UI. The fix: the list view kept only header fields plus a to-one aggregated value from a separate view (sum of item net amount per order and currency), and item details moved to the object page, read via $expand only when an order is opened. The SQL trace showed the returned rows dropping from about 2.4 million to 60,000, and the list loaded in under two seconds.
CDS Views Part 4: Authorization with DCL and Clean-Core Data Access
Control which rows each user may see with CDS access control (DCL): authorizationCheck values, pfcg_auth conditions, inheriting roles in projections, privileged access — and read SAP data the clean-core way through released CDS views.
An analytics app on sales orders was used by regional managers. During UAT a manager from one region exported data of all regions. The CDS views had @AccessControl.authorizationCheck: #CHECK, but nobody had created the DCL roles — the activation only showed a warning, which was ignored. The team added a role on the interface view using pfcg_auth with the sales organization, and inheriting roles on every consumption view. They also found one custom report that selected the table directly and therefore ignored all restrictions; it was switched to the view. A final check compared row counts per test user before go-live, and the "#CHECK without role" warning was added to the ATC check variant as a blocking finding.
Interview questions covered
- What is a CDS view entity, and how does it differ from a classic CDS view defined with @AbapCatalog.sqlViewName?
- Explain the virtual data model layers (interface, composite, consumption, and RAP R_ views). Why not put everything into one CDS view?
- A Fiori list based on a CDS consumption view is slow and shows some orders several times. What is the likely cause and how do you fix it?
- What is the difference between a join and an association in CDS, and why does it matter for performance?
- Regional managers can see sales orders of all regions in a CDS-based app although @AccessControl.authorizationCheck: #CHECK is set. What went wrong and how do you fix it?
- Walk through creating your first CDS view entity in ADT and verifying it.
- What is the difference between a CDS view entity and a classic DDIC-based CDS view?
- How do you design CDS access control (DCL) for a sales order view and its projection?