What does code pushdown (code-to-data) mean in ABAP on SAP HANA, what do you push down, and what do you leave in ABAP?
Say your answer out loud first.
Practise another way
Code pushdown means moving data-heavy calculation to the database instead of pulling rows into ABAP and looping. On HANA the database is fast at aggregating, joining and filtering large sets, so I use ABAP SQL, CDS views, and only if needed AMDP.
I keep orchestration, authorization, business rules that need ABAP objects, and small result sets in ABAP. I prove the gain with a before and after trace.
Idea: the cost of an ABAP report is often the data moved between database and application server, plus the ABAP loops over it. On HANA, set operations run in memory in the database. So you send the question, not the data.
Push down
- Filters in
WHERE, notCHECKafter the read. - Aggregation with
SUM,COUNT,GROUP BY,HAVING, instead of loops that add up. - Joins instead of nested
SELECTs orFOR ALL ENTRIESon big tables. - Calculations with
CASE, string, date and arithmetic expressions in the field list. - Reusable logic as a CDS view, so Fiori, ABAP and analytics share it.
" pull-up: all rows travel to ABAP, then loop and add
SELECT carrid, seatsocc FROM sflight INTO TABLE @DATA(rows).
" pushdown: only one row per carrier travels
SELECT carrid, SUM( seatsocc ) AS occupied
FROM sflight
GROUP BY carrid
INTO TABLE @DATA(totals).
Do not push down (or do it carefully)
- Logic that needs ABAP classes, authority checks per row or locking.
- Tiny tables, where a round trip is cheaper than the design effort.
- Business rules that change often and are better unit tested in ABAP.
- Anything that makes the code unreadable. SQLScript is harder to test and debug than ABAP SQL.
Order of preference (the SAP guidance I follow): ABAP SQL first, then a CDS view or CDS table function, and AMDP only when SQL and CDS cannot express it.
Prove it: compare runtime and the SQL trace before and after, with the same data volume. Look at number of database calls, rows transferred, and total time. Quote numbers, not feelings.
Trade-off: the database is a shared resource. A pushed-down statement that scans everything still costs memory and CPU for all users.
Gives the principle, concrete things to push and not push, the preference order (ABAP SQL, CDS, AMDP) and a measurement.
Says 'HANA is fast so put everything in the database', or only recites 'code-to-data' without an example.
Treating pushdown as 'use AMDP'. Most of the gain comes from plain ABAP SQL and CDS, and AMDP adds restrictions and maintenance cost.
- Show me a loop you would replace with a GROUP BY.
- Why might pushdown make a report slower?
- When would you pick AMDP?
- How would you measure rows transferred?
2 official pages, 6 prep guides and 1 technical reference. Confidence: high. Checked 21 Nov 2026.
- Technical reference Backs the answer.
- Official page Backs the answer.
- Official page Backs the answer.
- Prep guide Gives the question.
- Prep guide Gives the question.
- Prep guide Gives the question.
- Prep guide Gives the question.
- Prep guide Gives the question.
- Prep guide Gives the question.