Sub topic 1
What embedded analytics is and how it is built
Embedded analytics in SAP S/4HANA runs reports and KPIs directly on live transactional data. It does not copy that data into a separate warehouse first. This chapter explains the idea, the architecture, and the building blocks you will use in later chapters.
Prerequisites
This chapter assumes you already know:
- Basic SQL: SELECT, JOIN, GROUP BY and aggregate functions.
- SAP S/4HANA business objects such as sales orders and customers.
- How to open apps from the SAP Fiori launchpad.
- The difference between transactional (OLTP) and analytical (OLAP) workloads.
You do not need to know CDS syntax yet. Later chapters cover it.
The core idea
In a classic setup, a data warehouse receives copies of transactional data through scheduled extraction jobs. Reports run on the copy. This gives you history and cross-system joins, but the data is only as fresh as the last load, and you maintain a second system.
Embedded analytics removes the copy for operational reporting. The SAP HANA database handles both transactional and analytical queries on the same tables. Analytical logic is defined once, in ABAP CDS views (Core Data Services views, which are SQL-like definitions stored in the ABAP system). When a user opens a report, HANA aggregates the live rows at query time.
| Aspect | Embedded analytics | Separate data warehouse |
|---|---|---|
| Data freshness | Live, no load delay | As fresh as the last load |
| Data copy | None for operational reports | Replicated and stored again |
| Best for | Operational reporting on one S/4HANA system | Cross-system, historical, large-scale reporting |
| Modeling tool | CDS views with annotations | Warehouse-specific models |
| Extra system to run | No | Yes |
Embedded analytics does not replace a warehouse in every case. If you must combine data from many source systems or keep years of snapshots, a warehouse is still the better fit.
How it is built
The stack has four parts, from bottom to top:
- Tables. The transactional tables of S/4HANA hold the data.
- CDS views. Views read the tables and add meaning. Annotations (metadata tags that start with
@) tell the analytical engine which view is a cube, which is a dimension, and which is a query. - Analytical engine. The engine reads the annotations, builds the aggregation, and handles currencies, units, and authorizations.
- Front ends. Fiori analytical apps, KPI tiles, and other tools display the result.
A first look at the building blocks
Three kinds of CDS views appear in most analytical models. A dimension describes business objects you group by, such as customers. A cube holds the facts you measure, such as sales items with amounts. A query chooses what to show on rows and columns.
Here is a dimension for customers. It exposes a key, a text field, and an attribute. The table zcustomer is a hypothetical custom table.
@AccessControl.authorizationCheck: #NOT_REQUIRED
@EndUserText.label: 'Customer'
@Analytics.dataCategory: #DIMENSION
define view entity ZI_CustomerDim
as select from zcustomer
{
key customer_id as CustomerId,
@Semantics.text: true
customer_name as CustomerName,
country as Country
}The annotation @Analytics.dataCategory: #DIMENSION is what turns an ordinary view into an analytical dimension. @Semantics.text: true marks the name as the readable text for the key.
The same pattern, with #CUBE and a measure, defines a cube. A query view then reads the cube. You will build both in the chapters on cubes and queries.
Common mistakes
- Expecting a warehouse. Embedded analytics runs on current data in one system. It is not built for combining many source systems.
- Heavy queries on the transactional system. Because analytics shares the database with business transactions, poorly designed queries can slow down daily work. The performance chapter covers this.
- Skipping annotations. Without analytical annotations, a CDS view is only a plain view. The engine cannot treat it as a cube or dimension.
Exercise
A team needs a daily sales report from one S/4HANA system and wants the numbers to include orders posted a few minutes ago. Is embedded analytics a good fit, and which annotation marks the view that holds the sales amounts?
Show answer
Yes. Embedded analytics reads live transactional data in the same system, so recent postings appear without a load job. The view that holds the amounts is a cube, marked with @Analytics.dataCategory: #CUBE.