Moving ABAP Logic Down to the HANA Database
Code pushdown means moving data-intensive logic out of the ABAP application layer and into the HANA database, using Open SQL that exploits HANA's engines, CDS views with calculation logic, or AMDP methods written in SQLScript. It cuts data transfer and loop-based processing in ABAP, but it also moves debugging, testing and portability out of familiar ABAP territory.
This page covers what code pushdown actually changes in the ABAP-to-database relationship, when it earns its complexity and when it is over-engineering, and how CDS views and AMDP fit against plain Open SQL. It focuses on the operational and architectural decisions consultants get asked to make, not on SQLScript syntax.
Published 16 Sept 2026· 1,428 words
What it is
Code pushdown is the practice of executing data processing inside the HANA database rather than pulling records into the ABAP application server and processing them there in loops. The structural fact that explains most confusion: pushdown is not one technology, it is a spectrum. At the shallow end, writing tighter Open SQL that lets HANA do joins, aggregations and filtering instead of doing them in ABAP after a SELECT is already pushdown. Further down the spectrum sit CDS views, which express reusable data models and calculations as database views with annotations. At the deep end sit AMDP (ABAP Managed Database Procedures), which are ABAP method bodies whose implementation is actual SQLScript, compiled and executed as native HANA procedures. Consultants often use 'pushdown' to mean only AMDP, then argue past each other because someone else means 'stop reading tables into internal tables and looping'.
When to use it
Reach for pushdown when a program reads a large data set, does aggregation, ranking, currency conversion or complex joins, and then discards most of the rows before doing anything ABAP-specific with the result. Financial consolidation, mass valuation runs, and reporting layers behind Fiori apps are typical candidates. It is the wrong tool when the logic is small in data volume but rich in business rules that change often, where SQLScript's poorer debugging and versioning story costs more than the runtime saved. It is also wrong when the only motivation is 'HANA is fast, so push it down' without having measured where time actually goes; plenty of slow programs are slow because of row-by-row RFC calls or nested loops, not because the database work sits in the wrong layer. Pushing down logic that is not database-shaped, such as complex conditional branching against non-DB data, mainly creates a maintenance burden.
How it fits the stack
Above pushdown logic sits the ABAP application: the class or program that calls a CDS view via Open SQL, or invokes an AMDP method through its ABAP method signature. Below it sits the HANA calculation and SQL engines that actually execute the joins, aggregations and procedures. Pushdown does not replace Open SQL, it is implemented through it, or through AMDP's SQLScript body, which is itself invoked like any other ABAP method. What it supersedes is the older pattern of SELECT-heavy ABAP with in-memory internal-table processing that was tuned for row-store databases and application-server CPU being the cheaper resource. In an S/4HANA system this pattern also intersects with the virtual data model: many CDS views used for pushdown are the same views exposed for analytics and Fiori, so a change in a pushdown view can ripple into reporting.
A worked example
A billing report currently selects millions of billing item records into an internal table, then loops to convert currency, apply a discount tier lookup against a customer master table, and sum by sales organization. On production volumes this takes minutes and the application server memory footprint is large. Rework starts by writing a CDS view over the billing item table that joins the customer master, exposes currency conversion via a standard association or built-in currency conversion function, and does the sales-organization aggregation as a GROUP BY. The ABAP program is reduced to one Open SQL statement selecting from this CDS view with a WHERE clause on the selection screen parameters. If the discount tier logic is too irregular for CDS expressions, that one piece moves into an AMDP method that takes the pre-aggregated result as input and returns discount-adjusted totals, keeping SQLScript scope narrow. The ABAP layer keeps the selection screen, authorization check, and output formatting; the heavy lifting happens once, in the database, instead of row by row in application server memory.
How to choose
- Volume first: measure actual row counts and current runtime before deciding pushdown is warranted; pushdown fixes I/O and processing volume problems, it does not fix a badly designed data model.
- Open SQL versus CDS versus AMDP: prefer Open SQL improvements first (fewer round trips, pushed-down WHERE and JOIN), then CDS views for reusable, declarative logic, and reserve AMDP for genuinely procedural logic that cannot be expressed set-based, such as iterative algorithms.
- Testability cost: AMDP methods are harder to unit test and harder to mock than ABAP classes; ask whether the logic changes often enough that this cost matters, or is stable enough that it does not.
- Portability and clean core: SQLScript in AMDP is HANA-specific and sits outside the released API model; ask whether the object needs to remain extensible or upgradable through key-user tools, in which case pushdown via custom AMDP is the wrong layer.
- Team skill and ownership: SQLScript debugging and performance tuning require different skills than ABAP; confirm someone on the team, or in support, can actually maintain the procedure two years from now, not just build it.
- Reversibility: pushdown implemented as a CDS view can be dialed back or extended relatively cheaply; pushdown implemented as a large AMDP procedure is expensive to unwind once business logic accretes inside it.
Common pitfalls
- AMDP procedures that grow business logic over successive change requests until they are unreviewable SQLScript blocks nobody wants to touch, effectively becoming a second, invisible application layer.
- Pushdown logic that works correctly and quickly on a development-sized data set but times out or exhausts working memory on production volumes because the calculation engine chosen (column engine versus row engine paths) was never validated at scale.
- CDS views built for pushdown that get reused unmodified as the basis of an analytical or Fiori app, so a performance fix in the pushdown view silently changes numbers shown to end users elsewhere.
- Currency and unit conversion done twice, once inside the pushed-down view and again in ABAP, because the original SELECT ... INTO TABLE code was never fully removed after the CDS view was introduced.
- AMDP methods that bypass ABAP authorization checks because the SQLScript reads tables directly; the pushdown developer has to reimplement authorization logic explicitly, and it is easy to forget.
- Loss of standard ABAP debugging: breakpoints inside SQLScript require HANA-side tracing tools, and developers used to the ABAP debugger lose time locating where a wrong result actually originates.
- Upgrade fragility: custom AMDP tied closely to specific table structures breaks silently when the underlying tables change shape in an S/4HANA release upgrade, and the failure surfaces as a runtime dump rather than a syntax error at compile time.
ECC, S/4HANA and clean core
In a clean core S/4HANA strategy, deep pushdown via custom AMDP is treated cautiously because SQLScript sits outside the released, upgrade-stable API surface and is not something key-user extensibility tools can touch. CDS view based pushdown is more acceptable because CDS is a first-class, versioned modeling layer with its own extension mechanisms, and much of it is delivered and maintained by SAP already. The general direction is to prefer standard CDS views and released APIs over hand-written SQLScript, and to treat custom AMDP as a targeted exception for genuinely procedural, high-volume logic rather than a default performance lever. Existing ECC custom code with heavy row-by-row processing is one of the classic categories flagged during a conversion for pushdown redesign, not because the old code is wrong, but because it was tuned for an architecture that no longer applies.
Whose problem this is
This is developer work with architect sign-off. The developer designs and implements the CDS view or AMDP method; the architect decides where on the pushdown spectrum a given piece of logic belongs and whether it conflicts with clean core policy. Handover should include the measured before-and-after runtime, the data volume tested against, and an explicit note of what authorization or currency logic was reimplemented inside the pushed-down layer.
Related SAP objects
Reviewed pages this object connects to in the ERPClimb knowledge graph.
Source: ERPClimb — https://erpclimb.com/sap-technical-topics/code-pushdown-from-abap-to-hanaERPClimb is an independent platform and is not affiliated with SAP SE. Reference pages are written and reviewed by SAP consultants for learning and troubleshooting.