โ† Back to Clean Core Architecture Hub
CLEAN CORE ARCHITECTURAL GUIDE #14

SAP Embedded Analytics & CDS Analytical VDM Architecture

Author: Andrea Antonio Perrelli Scope: SAP S/4HANA Cloud (Public/Private) & On-Premise 2022+ Engine: Analytical Engine (In-Memory Multidimensional VDM)
Architectural Paradigm: In SAP S/4HANA Clean Core, operational reporting is executed directly on top of transactional persistence without ETL batch pipelines. The Analytical Virtual Data Model (VDM) uses declarative CDS View Entities annotated with #DIMENSION and #CUBE to provide zero-latency analytical queries for SAP Analytics Cloud (SAC) and Fiori Analytical Cards.
Limited Time Deal

Master S/4HANA Clean Core Architecture & Analytics

Get the Complete SAP Enterprise Architecture Suite: 40 Retina architecture diagrams, 61 production-grade code listings, and decision frameworks. Use code FLASH80 at checkout for 80% OFF.

1. The 3-Layer Analytical Virtual Data Model (VDM)

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

2. Key Annotations Reference Guide

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.

3. Production Blueprint: Currency Conversion in Analytical CDS

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
};

4. When to Use Embedded Analytics vs. SAP Datasphere

A common architectural dilemma is choosing between on-stack Embedded Analytics and external Data Warehousing:

Architecture Selection Rule:

Recommended Clean Core Developer Tools

Explore free client-side interactive utilities to accelerate your S/4HANA migration:

๐Ÿ“Š Analytical Query Builder ๐Ÿงน CDS View Modernizer ๐Ÿ” CDS Access Control (DCL) ๐Ÿงญ Decision Wizard & ADR

Accelerate Your SAP Transformation

Get complete architectures, downloadable code listings, and decision frameworks in the official handbooks.