In the Context of SAP HANA Live
With SAP’s ongoing evolution towards in-memory computing and real-time analytics, Core Data Services (CDS) Views have become a fundamental technology in SAP’s data modeling strategy, especially in SAP HANA Live scenarios. A key feature that elevates CDS Views beyond traditional database views is the use of annotations.
This article explores what annotations are, why they matter, and how they empower CDS Views to deliver rich, semantically aware, and highly reusable data models.
Annotations in CDS Views are metadata markers or declarative instructions embedded within the CDS definition. They provide additional context about the data and how it should be treated or presented by consuming applications.
Think of annotations as tags that enrich the data model with semantics — for example, indicating which fields represent currency, dates, or keys, or specifying how the view should behave in UI or analytical tools.
Semantic Enrichment:
Annotations define the meaning of data elements beyond raw types. For instance, identifying a field as a "currency amount" rather than just a decimal number helps UI frameworks display it properly.
Integration with SAP UI Technologies:
Annotations allow CDS Views to communicate with frontend technologies like SAP Fiori and SAP Analytics Cloud, enabling automated UI generation without manual coding.
Enhanced Data Consumption:
By embedding instructions about aggregation, default filters, or OData exposure, annotations simplify data consumption and improve end-user experience.
Standardization and Reusability:
They help standardize how data models are built and consumed across various SAP applications, encouraging reuse and consistency.
Annotations can be broadly categorized based on their purpose:
These describe the nature of the data fields.
@Semantics.currencyCode — marks a field as currency.@Semantics.amount.currencyCode — links amount and currency fields.@Semantics.date — defines a field as a date.Used to support analytical processing.
@Analytics.dataCategory — marks a view as an analytical data source.@Aggregation.default — sets default aggregation behavior.@Analytics.measure — flags a field as a measure.Directly influence UI behavior and appearance.
@UI.lineItem — marks fields to be shown in list reports.@UI.selectionField — makes a field available for selection in filters.@UI.identification — fields used to identify an entity.Control how views are exposed as OData services.
@OData.publish: true — automatically generates an OData service for the view.@OData.entitySet.name — defines the OData entity set name.@AbapCatalog.sqlViewName: 'ZCDS_ANNO'
@AccessControl.authorizationCheck: #NOT_REQUIRED
@OData.publish: true
@Analytics.dataCategory: #CUBE
define view Z_CDS_Invoice
as select from snwd_so
{
key snwd_so.so_id as SalesOrder,
snwd_so.currency_code as Currency,
snwd_so.net_amount as NetAmount,
@Semantics.currencyCode: 'Currency'
snwd_so.currency_code as CurrencyCode,
@Semantics.amount.currencyCode: 'CurrencyCode'
snwd_so.net_amount as Amount
}
@OData.publish: true exposes this view as an OData service.@Analytics.dataCategory: #CUBE indicates that this view is intended for analytical reporting.@Semantics.currencyCode and @Semantics.amount.currencyCode link amount and currency fields, enabling correct handling by consuming applications.In SAP HANA Live, CDS views enriched with annotations are at the heart of Virtual Data Models (VDM), enabling:
Annotations thus allow developers and architects to design models that are self-describing, extensible, and optimized for SAP’s ecosystem.
Annotations transform CDS Views from simple data projections into rich semantic models that support real-time analytics, UI integration, and service exposure in SAP HANA Live environments. Understanding and leveraging annotations is crucial for any SAP professional working with SAP HANA Live and modern SAP data modeling.
By mastering annotations, organizations can build powerful, efficient, and user-friendly SAP solutions that fully harness the power of SAP HANA’s in-memory platform.