ERPClimb logoERPClimb
Performance Tuning
ABAP Developmentadvanced 7 min read

Performance Part 8: HANA Pushdown with Open SQL, CDS and AMDP

Preview · a free account unlocks the full lesson

Key takeaway

Move data-intensive logic to SAP HANA: code-to-data principle, aggregations and joins in Open SQL, CDS views for reusable models with calculations and associations, AMDP for procedural SQLScript, when pushdown helps and when it doesn't, and keeping classic ABAP readable.

In this lessonShow sections

Visual overview

Performance Part 8: HANA Pushdown with Open SQL, CDS and AMDP — learning sheetFlow: Replace an ABAP loop that sums per customer with SELECT … SUM … GROUP BY → Create a simple CDS view joining order header and items with a calculated field (ADT) → Compare runtime of the ABAP and pushdown versions with realistic data. Key ideas: WHY PUSHDOWN; OPEN SQL PUSHDOWN; CDS VIEWS; AMDP. Watch out: Don't push everything into AMDP — SQLScript is harder to debug, maintain and transport-test; use the simplest level that solves the problem.ERPClimb.com / ABAP / LESSON 8/10 / LEARNING SHEETPerformance Part 8: HANA Pushdown with Open SQL, CDS andAMDP1 · HOW IT FLOWS1Replace an ABAP loop thatsums per customer withSELECT … SUM … GROUP BY2Create a simple CDS viewjoining order header anditems with a calculated…3Compare runtime of theABAP and pushdownversions with realistic…2 · KEY IDEAS EXPLAINEDWhy PushdownHANA is in-memory and columnar: aggregations andscans over many rows are fast.Transferring millions of rows to the applicationserver and summing in ABAP wastes time and memory.Open SQL PushdownAggregates with GROUP BY and HAVING, JOINs,subqueries, CASE expressions, arithmetic(depending on release).Classic syntax still works for SUM/COUNT/GROUP BY;newer syntax offers more expressions.CDS ViewsDefined in ADT (Eclipse): SELECT withjoins/associations, calculated fields,aggregations, parameters.Reusable by reports, OData, analytics; consumed inABAP like a table (SELECT FROM zcds_view).AMDPABAP class with methods implemented in SQLScript(BY DATABASE PROCEDURE / FUNCTION FOR HDB).For complex multi-step set logic not expressiblein CDS/Open SQL.3 · REMEMBER · WATCH OUTRememberCode-to-data: let HANA filter, join, aggregate and calculate, andreturn only the result — instead of transferring raw rows to ABAP.Levels of pushdown: 1) good Open SQL (joins, aggregates, CASE,expressions), 2) CDS views (reusable, with associations and…Pushdown pays off for large volumes and set operations; simplesingle-record access gains little.!Watch outDon't push everything into AMDP —SQLScript is harder to debug,maintain and transport-test; use thesimplest level that solves theproblem.4 · IN A REAL PROJECTA customer profitability report on S/4HANA read 30 million line items into ABAP and aggregated them in nestedloops, running 2 hours and often failing with memory dumps. A CDS view aggregating by customer, product groupand period returned 40,000 rows directly; the ABAP report only formatted them. Runtime dropped to 3 minutes…Original ERPClimb learning sheet • Verify against your SAP release and edition

Explanation

Parts 2 through 7 of this series focused on reducing round trips and the volume of data moved; on HANA, you can go further and actually compute inside the database. This is code-to-data pushdown: let HANA filter, join, aggregate, and calculate, and return only the result, instead of transferring raw rows to ABAP and doing the work there.

The reason this matters is that HANA is in-memory and columnar, so aggregations and scans over many rows are fast there, while transferring millions of rows to the application server just to sum them in ABAP wastes both time and memory.

There are three levels of pushdown. The first is good Open SQL: aggregates with GROUP BY and HAVING, JOINs, subqueries, CASE expressions, and arithmetic (depending on the release) — classic syntax still works for SUM, COUNT, and GROUP BY, while the newer syntax offers more expressions.

The second is CDS views, defined in ADT (Eclipse) as a SELECT with joins or associations, calculated fields, aggregations, and parameters; they're reusable across reports, OData, and analytics, and are consumed in ABAP just like a table, with a plain SELECT FROM zcds_view, and they can carry annotations for authorization (DCL), analytics, and UI.

The third is AMDP: an ABAP class whose methods are implemented in SQLScript, using BY DATABASE PROCEDURE or FUNCTION FOR HDB, for complex multi-step set logic that can't be expressed in CDS or Open SQL; it can be debugged with the AMDP debugger in ADT.

Free account

Create a free account to keep reading

You have read the opening of this lesson. A free ERPClimb account unlocks the rest of it, every other lesson and topic, and your learning history, so you can pick up exactly where you stopped. No card needed.

  • Full explanation
  • Code example
  • Real project scenario
  • Common mistakes
  • Best practices
  • Interview angle

One tap with Google works too. Every topic keeps its first lesson open to everyone.

Keep exploring

Check before use: lesson examples are educational, not a guarantee of correctness for your SAP edition or release. Sample code has not been executed on your SAP system. Confirm API availability, syntax, authorizations and business impact in an approved development or test environment.