#DIMENSION and #CUBE to provide zero-latency analytical queries for SAP Analytics Cloud (SAC) and Fiori Analytical Cards.
The SAP Analytical VDM organizes business data into three strictly typed layers:
| VDM Layer | CDS Annotation | Architectural Purpose | Example Entities |
|---|---|---|---|
| Dimension View | @Analytics.dataCategory: #DIMENSION |
Master data attributes, texts, and foreign keys used for slicing and dicing. | I_Customer, I_Product, I_CompanyCode |
| Composite Cube | @Analytics.dataCategory: #CUBE |
Transactional fact data containing measurable KPIs and associations to Dimensions. | I_SalesOrderItemCube, I_JournalEntryItemCube |
| Consumption Query | @Analytics.query: true |
Transient multidimensional query defining axes (Rows, Columns, Free), filters, and formulas. | C_SalesOrderAnalyticsQuery, C_TrialBalanceQuery |
Correct annotation usage determines how the SAP HANA analytical engine computes aggregations and exposes data to SAC:
| Annotation | Target Element | Permitted Values / Syntax | Description |
|---|---|---|---|
@DefaultAggregation |
Measure (Amount, Quantity) | #SUM, #MAX, #MIN, #AVG, #FORMULA |
Specifies how the analytical engine aggregates values across dimensions. |
@Semantics.amount.currencyCode |
Monetary Measure | Field reference (e.g., 'TransactionCurrency') |
Binds numerical amounts to their authoritative currency key. |
@Semantics.quantity.unitOfMeasure |
Physical Quantity | Field reference (e.g., 'OrderQuantityUnit') |
Binds numerical quantities to their ISO unit of measurement. |
@AnalyticsDetails.query.axis |
Query Element | #ROWS, #COLUMNS, #FREE |
Determines the default multidimensional placement in SAC or Fiori grid. |
@AnalyticsDetails.query.totals |
Query Element | #SHOW, #HIDE |
Controls display of cumulative sub-totals and grand totals. |
In global enterprises, transactions occur in local document currencies (EUR, USD, JPY). To perform accurate cross-company aggregation, amounts must be dynamically translated to a target group currency (e.g., EUR) using SAP's built-in CURRENCY_CONVERSION function:
@AccessControl.authorizationCheck: #CHECK
@EndUserText.label: 'Global Sales Performance Cube'
@Analytics.dataCategory: #CUBE
@VDM.viewType: #COMPOSITE
define view entity ZC_GlobalSalesCube
as select from I_SalesOrderItem as Item
association [0..1] to I_Customer as _Customer on $projection.SoldToParty = _Customer.Customer
{
key Item.SalesOrder,
key Item.SalesOrderItem,
Item.SoldToParty,
Item.Product,
Item.SalesOrderDate,
Item.TransactionCurrency,
// Local Transaction Currency Amount
@DefaultAggregation: #SUM
@Semantics.amount.currencyCode: 'TransactionCurrency'
Item.NetAmount as NetAmountInLocalCurrency,
// Dynamically Converted Group Currency Amount (EUR)
@DefaultAggregation: #SUM
@Semantics.amount.currencyCode: 'GroupCurrency'
@EndUserText.label: 'Net Amount (EUR Group Currency)'
currency_conversion(
amount => Item.NetAmount,
source_currency => Item.TransactionCurrency,
target_currency => cast( 'EUR' as abap.cuky( 5 ) ),
exchange_rate_date => Item.SalesOrderDate,
exchange_rate_type => 'M',
error_handling => 'SET_TO_NULL'
) as NetAmountInGroupCurrency,
cast( 'EUR' as abap.cuky( 5 ) ) as GroupCurrency,
_Customer
};
A common architectural dilemma is choosing between on-stack Embedded Analytics and external Data Warehousing:
Architecture Selection Rule:
Explore free client-side interactive utilities to accelerate your S/4HANA migration: