SAP ABAP CDS View Annotations
Annotations in ABAP Core Data Services (CDS) views enhance functionality by defining metadata, behavior, and UI properties. They help control aspects like security, performance, and visualization.
🔹 Common CDS Annotations
Category | Annotation | Purpose |
---|---|---|
General | @AbapCatalog.sqlViewName | Defines the SQL view name in the database. |
@AbapCatalog.compiler.compareFilter | Optimizes filter performance. | |
Data Exposure | @AccessControl.authorizationCheck | Enforces authorization using DCL. |
UI & Fiori | @OData.publish: true | Exposes the CDS as an OData service. |
@UI.lineItem | Defines columns in an SAP Fiori list report. | |
Performance | @VDM.viewType | Specifies the type (Basic, Composite, Consumption). |
@Analytics.dataCategory | Defines analytical behavior (e.g., Cube, Dimension). |
🔹 Example CDS View with Annotations
@AbapCatalog.sqlViewName: 'ZDEMO_CDS'@AccessControl.authorizationCheck: #CHECK@OData.publish: truedefine view ZDEMO_CDS as select from sflight { key carrid, key connid, fldate, price}
This example:
✅ Creates a database view (ZDEMO_CDS
).
✅ Enforces authorization (CHECK
).
✅ Publishes as an OData service.