Indu Learning Platform
Course/Unit 3 · The modern S/4HANA stack
Lesson 3-1

CDS views and the virtual data model

How S/4HANA exposes its data through layered CDS views, and how you build your own views to find and fix bad master data.

Watch first1) Create an ABAP CDS View in less than 10 Minutes in Eclipse with ABAP Developer Tools | Tutorial · Code With BrandonOpen on YouTube ↗

From tables to a data model

S/4HANA still has KNA1, LFA1 and MARA, but SAP wants apps, reports and integrations to read the virtual data model (VDM) instead: layered CDS views that give the tables business names, associations, semantics and authorization checks. 'Virtual' means nothing is copied; the SQL is pushed down to HANA when the view is queried.

ConsumersFiori apps, analytics, OData APIs, AI agentsConsumption viewsC_… one app or one queryComposite viewsI_… combine basic views, add logicBasic (interface) viewsI_… one business object, clean namesDatabase tablesBUT000, KNA1, LFA1, MARA
The VDM stack. Build on released I_ views, not raw tables.

The view types and their prefixes

The prefix tells you what a view is for. Also check the release state (API State tab in ADT): a view released for cloud development is a stable API, and clean-core extensions (lesson 3-4) may only use released objects.

PrefixView typeReuse?ExampleI_BasicYes, the defaultI_BusinessPartnerI_CompositeYesI_CustomerC_ConsumptionNo, one appC_… for a Fiori appR_Restricted reuse (RAP)Within the BOR_… transactional baseZ / YYour ownYour callZI_BPMissingTaxNumber
'Which layer would you build on?' Released I_ views.

Try it: sort into layers

Try it · Sort

Put each object in its VDM layer.

Database table
Interface view (I_)
Consumption view (C_)
Click an item, then a bucket (or drag it).

The master data views you will use most

Your table knowledge transfers directly: each view keeps the grain of the table underneath. Confirm exact field names in ADT (F2 on a view name) before writing a join.

Released CDS viewClassic tableI_BusinessPartnerI_CustomerI_CustomerCompanyI_CustomerSalesAreaI_SupplierI_SupplierPurchasingOrganizationI_ProductBUT000KNA1KNB1KNVVLFA1LFM1MARA1 row per BPgeneralper company codeper sales areageneralper purch. org1 row per product
Same grain, readable names.

Try it: complete a view entity

Use define view entity (the modern syntax since ABAP 7.55); the old define view with sqlViewName is obsolete. This view finds organisation BPs (category '2') with no tax number.

Try it · Fill the blanks

Fill the blanks so the view lists organisation BPs without any tax number.

@AccessControl.authorizationCheck: #CHECK
@EndUserText.label: 'Organisation BPs without any tax number'
define  ZI_BPMissingTaxNumber
  as select from  as bp
     I_BusinessPartnerTaxNumber as tax
      on tax.BusinessPartner = bp.BusinessPartner
{
   bp.BusinessPartner,
      bp.BusinessPartnerFullName
}
where bp.BusinessPartnerCategory = '2'
  and tax.BusinessPartner 

Build it in ADT, step by step

CDS views live in Eclipse with ABAP Development Tools (ADT), together with RAP and service bindings. It is the first technical skill to pick up.

Step through · 1 of 6
Connect ADTABAP projectNew data definitionpackage $TMP or Z…Choose templatedefineViewEntityWrite select +fieldsCtrl+SpaceActivateCtrl+F3Data previewF8
In Eclipse with ADT installed, create an ABAP project that points at your S/4HANA system or a BTP ABAP environment trial.
About ten minutes the first time.

Aggregations: a scorecard in one view

Management wants numbers, not rows. A case turns each row into 1 or 0 and sum counts them, all inside HANA.

DE4%US11%IN23%BR31%CN17%
Made-up output: % missing TaxNumber1. Outliers usually mean a source mapping gap.
CDS
@AccessControl.authorizationCheck: #NOT_REQUIRED
@EndUserText.label: 'Customer completeness by country'
define view entity ZI_CustomerDQByCountry
  as select from I_Customer
{
  key Country,
      count(*)                                         as CustomerCount,
      sum( case when TaxNumber1 = '' then 1 else 0 end ) as MissingTaxNumber1
}
group by Country

Illustrative. Check field names in ADT; add an access control in a real system.

Classic access versus CDS

ECC habitsSELECT on KNA1/KNB1 in ABAP or SE16Joins rebuilt in every reportAuthorisation coded by handExtract to Excel, then analyseS/4HANA with CDSQuery released I_ viewsAssociations defined once, reusedAccess control (DCL) declared on the viewAggregate in HANA, expose as ODatavs
Same data, different habits.

From a view to a work list

Add a service definition and binding, plus UI annotations, and Fiori elements generates a list report with no front-end code. The same OData service serves Python scripts or an AI agent.

Data-quality rulemissing tax no.CDS view entityZI_…Service definitionexpose viewService bindingOData V4Fiori list report oragentsteward work queue
A rule becomes a live work queue. Lesson 3-4 adds RAP behavior.

Try it: pick the data source

Try it · What would you do?

You need a steward work list of suppliers missing purchasing-organisation data, on a clean-core S/4HANA system. What do you build your view on?

Remember

  • The VDM is a layered set of CDS views over the tables; nothing is copied.
  • Build on released I_ views with define view entity; C_ views serve one app.
  • One CDS rule can feed a Fiori work list, a KPI and an API.

Check yourself

Which view prefix marks the reusable interface layer of the VDM?
You need one row per customer per company code. Which view matches that grain?
What syntax should a new custom CDS view use on S/4HANA 2020 or later?
Why build a data-quality rule as a CDS view instead of a weekly Excel extract?