6.1Bloom · AnNot started

The pushdown ladder

Reading depth

What you'll learn

Push read logic down using the most declarative layer that can express it: CDS view first, AMDP later, ABAP loops last.

  • Ladder: CDS view → CDS table function + AMDP → AMDP procedure → Open SQL (joins/FAE) → ABAP loops.
  • The most declarative layer that fits wins — it gives the optimizer the most freedom.
  • CDS views are reusable, annotatable and upgrade-stable; AMDP is opaque SQLScript.

Code pushdown means doing set-oriented work where the data lives — on HANA — instead of dragging rows up into the ABAP application server to loop over them. The discipline is to choose the *most declarative* layer that can still express the requirement, because the more declarative the layer, the more the HANA optimizer can rewrite, parallelize and reuse plans for it.

For read-heavy logic the preference order is a ladder: a CDS view first; then a CDS table function backed by AMDP when CDS alone cannot express it; then a bare AMDP procedure when you must call imperatively and CDS will not do; then Open SQL with joins or FOR ALL ENTRIES for transactional flow; and only as a last resort, loops in ABAP over selected data. Each rung down trades optimizer freedom and reusability for raw expressiveness.

The reason a senior ABAP developer should internalize the order rather than reaching straight for AMDP is reuse and maintainability: a CDS view is consumable from Open SQL, RAP, analytics and OData, carries annotations and DCL, and survives upgrades as a released contract. An AMDP method is opaque SQLScript that only the database understands, harder to test and analyze. Climb down the ladder only when the rung above genuinely cannot express the logic.

Key points

  • Ladder: CDS view → CDS table function + AMDP → AMDP procedure → Open SQL (joins/FAE) → ABAP loops.
  • The most declarative layer that fits wins — it gives the optimizer the most freedom.
  • CDS views are reusable, annotatable and upgrade-stable; AMDP is opaque SQLScript.
  • Drop a rung only when the layer above cannot express the requirement.
  • ABAP loops over fetched rows are the last resort, not the default.

Examples

Reading the ladder

Aggregate open orders per customer → CDS view. Rank rows with a window function CDS can't express → CDS table function + AMDP. Bulk set-based close → AMDP procedure. A simple header+text join in a transaction → Open SQL join. Stitching two unrelated result sets row-by-row → only then an ABAP loop.

Source notes: clean-core-curriculum §6.1

Ask Claude

Build a prompt from this lesson + your question and open a fresh Claude chat with it pre-filled — handy for adapting a before/after pattern to your own object.