CDS Views
Architect / Cross-trackintermediate

CDS Basics and Associations

Modelling with @annotations and associations.

Explanation

CDS views are defined in ADT with DDL syntax and stored as DDIC objects (DDL source + generated view). Associations declare joins without materialising them until path expressions are used. Annotations control ODATA exposure, semantics (e.g. @Semantics.currencyCode) and UI hints.

Code example

ABAP Code
@AccessControl.authorizationCheck: #CHECKdefine view entity ZI_SalesHeader as select from vbak  association [0..*] to vbap as _Items on $projection.vbeln = _Items.vbeln{  key vbeln,      kunnr,      netwr,      _Items // exposed navigation}

Real project scenario

A sales analytics dashboard was built entirely on a stack of consumption CDS views, with no ABAP code โ€” only annotations.

Common mistakes

Materialising associations too eagerly (SELECT with all path expressions); missing DCL causing security gaps.

Best practices

Layer views (interface / composite / consumption); apply DCL at interface level; keep names namespaced.

Interview angle

Difference between association and join.