SAP Create CDS view
CDS views are the modern SAP data-modeling layer, defined in ABAP and run on HANA. This guide outlines creating one in ABAP Development Tools (Eclipse).
To create a CDS view, open ADT in Eclipse rather than SE80, add a Data Definition to your package, write define view entity over the source with the fields, joins, associations and aggregation you need, add annotations such as @OData.publish to expose it, activate, then check it in Data Preview. Layer base views under composite views and push filters down.
- Watch out: annotations decide how the view behaves in an app, so a correct view can still misbehave.
Step by step
- In ADT (Eclipse), create a new Data Definition (CDS) in your package.
- Define the view:
define view entity Z_... as select from <source> { ... }. - Add fields, joins/associations and aggregation as needed.
- Add annotations (e.g.
@OData.publish: true) to expose it as a service or shape UI/analytics. - Activate the view and test it (Data Preview), then consume it (Fiori/analytics/ABAP).
Notes and tips
Use ADT in Eclipse (not classic SE80) for CDS. Layer views, base views close to tables, composite views on top, for reuse. Annotations are what make CDS powerful (OData, analytics, UI). Push filters and aggregation down for performance, and follow naming conventions.
Common pitfalls
- Following steps without understanding the concept.
- Skipping testing in a non-production system.
- Applying blindly to a different scenario.