CDS Views
Architect / Cross-trackintermediate

CDS Views Part 4: CDS View Entity vs Classic (DDIC-Based) CDS View

Key takeaway

Compare the classic DDIC-based CDS view (define view with @AbapCatalog. sqlViewName) with the modern CDS view entity (define view entity), understand the technical differences, why view entities are the standard for new work, and how to handle existing classic views.

Explanation

📌 KEY POINTS
✅ Classic CDS view (define view): needs @AbapCatalog.sqlViewName and generates an extra SQL view visible in SE11. Two objects, two names.

✅ CDS view entity (define view entity): no SQL view in the DDIC, one name, faster activation, stricter syntax checks.

✅ SAP treats DDIC-based CDS views as obsolete in current releases — all new development uses view entities.

⚠️ Existing projects contain many classic views; you must read both styles and know that the SQL view name must never be used by new code.

━━━━━━━━━━━━━━━━━━━━
▶ WHERE WE ARE

Parts 1–3 used view entities. Many existing systems still contain classic CDS views — here is how they differ.

━━━━━━━━━━━━━━━━━━━━
▶ 1. CLASSIC DDIC-BASED CDS VIEW

  • Syntax: define view ZI_X as select from …
  • Mandatory @AbapCatalog.sqlViewName: 'ZIXSQL' (max 16 characters) — creates a DDIC SQL view.
  • @AbapCatalog.compiler.compareFilter and @ClientHandling annotations control generation details.
  • ABAP can read both the CDS name and the SQL view name — reading the SQL view bypasses CDS features like DCL.

━━━━━━━━━━━━━━━━━━━━
▶ 2. CDS VIEW ENTITY

  • Syntax: define view entity ZI_X as select from …
  • No sqlViewName, no generated DDIC view — only the CDS entity exists.
  • Client handling is implicit and automatic.
  • Stricter checks: currency/unit references mandatory, cleaner type rules for CASE and literals, no $parameters shortcut syntax issues.
  • Supports newer features (session variables in more places, better extension support).

━━━━━━━━━━━━━━━━━━━━
▶ 3. WHY VIEW ENTITIES

  • Faster activation and fewer transport objects.
  • No duplicate names to confuse consumers.
  • Future CDS features are delivered for view entities only.

━━━━━━━━━━━━━━━━━━━━
▶ 4. WORKING WITH EXISTING CLASSIC VIEWS

  • You can select from a classic view entity-wise (use the CDS name).
  • A view entity can select from a classic CDS view and vice versa.
  • Migration: SAP provides tooling in newer releases to migrate DDIC-based views to view entities — check the SAP note for your release, test consumers, and watch for changed types or behaviour.
  • Never reference the SQL view name (SE11 name) in new code.

━━━━━━━━━━━━━━━━━━━━
▶ 5. HOW TO RECOGNISE WHICH ONE

  • "define view entity" → view entity.
  • "define view" + @AbapCatalog.sqlViewName → classic.
  • In SE11, a classic view shows its SQL view; a view entity has none.

━━━━━━━━━━━━━━━━━━━━
▶ STEP BY STEP

  1. Open a classic CDS view in your system and note its sqlViewName.
  2. Create the same logic as a view entity — remove the sqlViewName and header catalog annotations, add currency references.
  3. Activate both and compare in ADT and SE11.
  4. In a classic report, select from the CDS names; confirm the results match.

✅ CHECKPOINT: you can recognise both styles, explain the differences and build new views only as view entities.

Code example

ABAP Code
// ===== STEP 1: classic DDIC-based CDS view (old style) =====@AbapCatalog.sqlViewName: 'ZISOHDROLD'@AbapCatalog.compiler.compareFilter: true@AccessControl.authorizationCheck: #NOT_REQUIRED@EndUserText.label: 'Sales order header - classic CDS'define view ZI_SalesOrderHdrOld  as select from vbak{  key vbeln as SalesOrder,      erdat as CreationDate,      kunnr as SoldToParty,      netwr as NetAmount,      waerk as TransactionCurrency} // ===== STEP 2: same logic as view entity (new standard) =====@AccessControl.authorizationCheck: #NOT_REQUIRED@EndUserText.label: 'Sales order header - view entity'define view entity ZI_SalesOrderHdrNew  as select from vbak{  key vbeln as SalesOrder,      erdat as CreationDate,      kunnr as SoldToParty,      @Semantics.amount.currencyCode: 'TransactionCurrency'      netwr as NetAmount,      waerk as TransactionCurrency} * ===== STEP 3: classic report - always use CDS names =====REPORT zcds_compare_styles. DATA: lv_old TYPE i,      lv_new TYPE i. START-OF-SELECTION.  SELECT COUNT(*) FROM zi_salesorderhdrold INTO lv_old.   "CDS name - OK  SELECT COUNT(*) FROM zi_salesorderhdrnew INTO lv_new.   "view entity * Avoid: SELECT ... FROM zisohdrold  (SQL view name, bypasses CDS features)   WRITE: / 'Classic view rows:', lv_old,         / 'View entity rows :', lv_new.  IF lv_old <> lv_new.    WRITE: / 'Difference - check WHERE/join logic'.  ENDIF.

Real project scenario

A client had 400 custom classic CDS views. Several reports read the SE11 SQL view names directly, so when DCL was added to the CDS views those reports still showed data from all sales organizations — an audit finding.
The team changed all consumers to CDS names, enforced "view entities only" for new development through code review, and migrated the most used classic views step by step with regression tests on row counts and totals.

Common mistakes

  • Creating new classic views out of habit (copying old templates with sqlViewName).
  • Reading the SQL view name in ABAP, bypassing DCL.
  • Migrating a classic view without testing its consumers.
  • Assuming both styles have identical type behaviour for CASE and literals.
  • SQL view names longer than 16 characters (activation error in classic views).

Best practices

  • Use define view entity for every new view.
  • Always consume CDS by its CDS name.
  • Add a code review check for sqlViewName in new objects.
  • Migrate classic views gradually, with row-count and total comparisons.
  • Document which classic views remain and why.

Interview angle

Questions: "Difference between define view and define view entity?", "What is sqlViewName?", "Why read by CDS name, not SQL view?"
Strong answer: classic views need @AbapCatalog.sqlViewName and generate a DDIC SQL view; view entities have no DDIC view, activate faster, apply stricter checks and are the standard for new work, with DDIC-based views obsolete. Reading the SQL view bypasses CDS features such as DCL access control, so consumers must use the CDS name.

Practice this lesson

Quick check

1. Which statement about a CDS view entity (define view entity) is correct?

2. A classic CDS view has @AbapCatalog.sqlViewName: 'ZISOHDR'. A new report should read its data. Which data source should the report use?

3. Which annotation is used on a CDS view to control how the mandatory client field of the underlying multi-client table is handled during data selection?

Interview questions

1. What is the difference between CDS view entity and classic CDS view?

Answer it in your own words first, then compare.

2. Your system has 400 classic DDIC-based CDS views and some reports read their SE11 SQL view names. What risks do you see and what is your plan?

Answer it in your own words first, then compare.

Practice more with Interview AI →

Reference-verified: the steps are checked against official SAP documentation and tutorials, and object and field names in the sample code are checked for consistency. The code has not been compiled or run on an SAP system by ERPClimb. Syntax marked release-dependent varies by SAP release, so check it in your own system.

More lessons in this topic

Interview questions on this topic

Related SAP topics