Blogs

3 Ways to Read Data on SAP HANA: Open SQL, CDS, Calc Views

3 Ways to Read Data on SAP HANA: Open SQL, CDS, Calc Views - Emrah Tezcan

Before comparing performance, it helps to understand the players. This post introduces the three main data-access techniques on an SAP HANA system: classic ABAP Open SQL, Core Data Services (CDS) views, and HANA Calculation Views. It covers what each one is, why it exists, and how they differ.

Introduction

Ask three SAP developers how to read and aggregate data on a HANA system and you may get three different answers: “just write a SELECT,” “build a CDS view,” or “model it as a Calculation View.” All three are correct, and that is exactly what makes the topic confusing. Each technique comes from a different era and a different layer of the SAP stack, each has its own strengths, and each is consumed differently from ABAP.

This post walks through the three approaches one by one, then puts their differences side by side. It is the conceptual companion to our measured performance comparison; here the goal is understanding, not milliseconds.

ABAP Open SQL: The Classic Workhorse

Open SQL (in newer releases called simply ABAP SQL) is the SQL dialect built into the ABAP language. It is how ABAP programs have read database tables for decades:

Its defining feature is database independence with deep ABAP integration. The same statement runs unchanged on any database SAP supports, because the ABAP kernel translates it into the native SQL of the underlying platform. Along the way, the kernel silently handles things the developer never has to think about: client handling (the MANDT filter is added automatically), type conversions between ABAP and database types, and efficient result transfer into internal tables.

Why is it used? Because it is the shortest path from an ABAP program to the data: no additional objects to create, no activation, no separate lifecycle. The query lives inside the program. Modern Open SQL has also grown powerful: joins, aggregations, CASE expressions, arithmetic inside SELECT lists, CTEs, and window functions are all available in current releases, which means substantial logic can be pushed down to the database in a single statement.

Its limitation is equally clear: an Open SQL statement is not reusable. The logic is trapped inside one program. If five reports need the same join-and-aggregate logic, it gets written five times, and that is precisely the problem the next technique solves.

CDS Views: Reusable Models Inside the ABAP Stack

Core Data Services (CDS) views are data models defined in Eclipse (ABAP Development Tools) as DDL sources. A CDS view captures a piece of data logic (joins, calculated fields, aggregations, associations) as a named, reusable, transportable object in the ABAP dictionary:

Any ABAP program can now consume this with a one-line SELECT, and every consumer gets the same, centrally maintained logic. Although the view is defined in the ABAP layer, it executes in the database. CDS is SAP’s primary vehicle for the code pushdown paradigm (“bring the code to the data”).

Why do we use CDS? Several reasons compound:

  • Reusability and a single source of truth. The logic is modeled once and consumed everywhere, replacing copy-pasted SELECTs.
  • Full ABAP lifecycle. CDS views travel through standard transports, are versioned with the rest of the ABAP code, and are checked by the ABAP toolchain.
  • Semantics, not just syntax. Annotations enrich the view with meaning (currencies and units, texts, analytics metadata, UI hints), which frameworks like Fiori Elements and Embedded Analytics read directly. A CDS view is not merely a query; it can drive an entire application screen.
  • Integrated authorizations. Access control (DCL) ties views to the ABAP authorization concept.
  • Strategic position. In S/4HANA, the Virtual Data Model (VDM), with thousands of interface and consumption views delivered by SAP, is built entirely on CDS. It is the intended modeling layer for ABAP applications going forward.
  • A gateway to reporting. Activating an analytics-annotated CDS view automatically generates a transient provider on the BW side, so BI front ends can consume it through the BW connectivity stack; alternatively, a CDS view can be exposed as an OData service via SAP Gateway. The OData route is what makes CDS the data source for Fiori and S/4HANA Embedded Analytics, a channel that Calculation Views cannot serve directly.

Compared with Open SQL, then, the difference is not where the query runs (both push down to HANA) but where the logic lives: inside one program versus as a shared, semantically rich dictionary object.

Calculation Views: Native Modeling in the HANA Database

Calculation Views come from the other side of the fence: they are native HANA objects, created in the HANA Modeler (HANA Studio, or Web IDE / Business Application Studio in newer setups) rather than in the ABAP stack. Instead of writing code, the developer builds a graphical data flow: projection nodes to select and filter, join nodes, union nodes, aggregation nodes, star joins for dimensional models, and calculated columns for row-level expressions, ending in a semantics node that declares which fields are attributes and which are measures.

Why do they exist, when CDS can express similar logic? Because their home turf is different:

  • Database-first scenarios. Calculation Views live entirely in HANA and can be consumed by anything that speaks SQL (BW and BPC, native HANA applications, analytics front ends) with no ABAP system required. In BW/BPC landscapes they are a first-class building block: Composite Providers can consume them, and planning logic can be pushed into them.
  • Visual development and debugging. Each node of the flow can be data-previewed individually, so complex transformations can be inspected step by step, a genuinely different development experience from writing SQL.
  • Runtime intelligence. Calculation Views prune at query time: columns that the consumer does not request, and union branches that a filter excludes, are simply not executed. A single rich view can efficiently serve many differently shaped queries.
  • Accessibility and direct BI connectivity. Because the modeling is graphical, building a Calculation View demands far less SQL fluency than writing DDL: nodes and connections replace code, which lowers the entry barrier for BI-oriented modelers. And since the view is an ordinary database object, reporting tools such as Power BI, Tableau, SAP BusinessObjects, or SAP Analytics Cloud connect to it directly through the HANA client’s ODBC/JDBC drivers, without an ABAP system in between.
  • Flexible deployment. Transport is not chained to the ABAP transport landscape: Views can travel via HANA’s own mechanisms (HALM / delivery-unit export and import, CTS+, or MTA deployment for HDI content) or, where tight coupling with ABAP is wanted, be pulled into the ABAP transport system via HTA.

From ABAP, however, a Calculation View is a guest, not a family member. It follows the HANA repository’s own lifecycle and authorization concept (analytic privileges), and consuming it from ABAP requires a bridge: today typically ADBC (native SQL against the _SYS_BIC runtime object) or an AMDP table function wrapped in a CDS table function. The old Dictionary External View approach has been declared obsolete/deprecated; while it can still technically be created in some scenarios, its use is no longer recommended. Native SQL also means the conveniences of Open SQL, such as automatic client handling, no longer apply automatically.

So Which One Should You Use?

The honest answer: they are not competitors so much as tools for different homes. A quick decision guide:

Use Open SQL when the logic belongs to one program and reuse is not on the horizon. It is the simplest and most direct option, and with modern syntax it pushes down as much as the others.

Use CDS when the consumer is the ABAP world and the logic deserves to be a model: shared across programs, annotated for Fiori or analytics, secured with DCL, transported with the rest of the code. In S/4HANA this is the strategic default.

Use Calculation Views when you are working natively on HANA (BW/BPC scenarios, cross-schema models, database-level transformations) or when the graphical, node-by-node development style genuinely fits the problem.

And performance? All three execute in the database, so the old intuition “closer to the database = faster” no longer separates them cleanly. Whether they actually perform identically on the same workload is an empirical question, and answering it properly, with measurements, traces, and execution plans, is exactly what we did in the companion post to this one. The short version: the results were not what the textbook ordering predicts.


Similar
Blog

Your mail has been sent successfully. You will be contacted as soon as possible.

Your message could not be delivered! Please try again later.