Interview Questions on CDS Views

Basic Questions

1. What is a CDS view? How is it different from a database view?

CDS (Core Data Services) view is an advanced way to model data in ABAP using SQL-like syntax.

Difference from database view:
Defined in Eclipse (not SE11)
Supports annotations (UI, OData, etc.)
Uses associations instead of joins
Better for Fiori, RAP, and analytics
Want to learn how to build CDS? Checkout our tutorials on CDS views

2. What are the different types of CDS views?

Basic Views – Directly model database tables; reusable building blocks.
 Composite Views – Combine multiple basic views; add logic or calculations.
 Consumption Views – Final views used in UI, analytics, or OData services.
 Analytical Views – Used for embedded analytics; include measures and dimensions.
 Hierarchy Views – Represent hierarchical data (e.g., org structures).
 View Entities – Newer CDS syntax with better performance and metadata handling.

3. What is the purpose of annotations in CDS views?

Annotations in CDS views are used to add metadata that guides how the view behaves or is used in different contexts like:
UI generation (e.g., @UI.lineItem)
OData exposure (e.g., @OData.publish: true)
Authorization checks (e.g., @AccessControl.authorizationCheck)
Analytics (e.g., @Analytics.query: true)
Text associations (e.g., @ObjectModel.text.association)
They help make CDS views semantic, reusable, and framework-aware without writing extra code.

4. How do you expose a CDS view as an OData service?

Define your CDS view with @OData.publish: true annotation.

5. What is the default join behavior in CDS views when using associations?

In CDS views, the default join type when using associations is effectively a LEFT OUTER JOIN. This ensures that the main (left) entity’s data is always returned, even if the association has no matching record.

6. What is an association in CDS? How is it different from a join?

An association in CDS is a semantic relationship between two data sources (like tables or views), defined using the association keyword. It replaces traditional joins with a more flexible and reusable structure.
FeatureAssociation (CDS)Join (SQL/CDS)
DefinitionDeclared using association keywordDeclared using join keyword
ExecutionNot executed until used (lazy evaluation)Executed immediately
UsageAccessed via path expressions (_assoc.field )Used directly in FROM clause
CardinalityExplicitly defined ([0..1] , [0..*] )Not explicitly defined
ReusabilityMore reusable and modularLess reusable

Intermediate Questions

1. What happens when specified wrong cardinality in Association

Cardinality Is a Hint, not a Filter. The cardinality of CDS association is not enforced at runtime. It is used by ABAP Compiler, ODATA Service generation and Tools like Fiori Elements for UI generation.
So, Cardinality does not restrict the number of records returned by the association but can lead to incorrect assumptions in consuming layers (UI, OData, etc.).

Leave a Comment

Your email address will not be published. Required fields are marked *