S/4HANAadvanced

ABAP Managed Database Procedures (AMDP)

Writing native HANA SQLScript logic callable directly from ABAP for maximum performance code pushdown.

AMDP comes up in advanced S/4HANA interviews specifically when a candidate has claimed performance-tuning or code-pushdown expertise, because it's the deepest level of database-layer optimization ABAP developers can reach - beyond CDS views - and interviewers use it to separate people who've genuinely written HANA-native logic from people who've only read about it.

A CDS view is like a well-defined recipe card the kitchen can follow declaratively; AMDP is handing the kitchen a fully procedural cooking show script with loops and conditional steps, because some dishes genuinely need more elaborate step-by-step logic than a static recipe card alone can express, and you still want it all done in the kitchen (HANA) rather than shipping raw ingredients to the dining room (ABAP layer) to be cooked there.

Key Concepts

1
An AMDP method is declared in an ABAP class implementing the IF_AMDP_MARKER_HDB marker interface, with the method body written directly in HANA SQLScript (not ABAP) inside an AMDP pragma block, and it's called from regular ABAP code exactly like any other method - the caller doesn't need to know or care that the implementation is native SQLScript rather than ABAP. This makes AMDP uniquely powerful for computationally heavy logic (complex aggregations, procedural loops over large datasets, statistical/algorithmic calculations) that would be painfully slow if written as ABAP looping over internal tables, since the logic executes entirely inside HANA's engine, operating directly on database tables without ever pulling rows into the ABAP application server's memory.
IF_AMDP_MARKER_HDBAMDP
2
AMDP methods can be table functions (returning a result set usable directly in further Open SQL statements, similar in spirit to how a CDS view can be consumed) or straightforward procedures. A classic real-world use case is complex margin/inventory valuation calculations, statistical forecasting logic, or graph-like/procedural algorithms (e.g., bill-of-material explosion with cycle detection) that are naturally iterative and don't express cleanly as a single declarative CDS view, but still benefit enormously from running inside HANA rather than the ABAP layer.
3
A senior-level answer is honest about AMDP's trade-offs: SQLScript is a genuinely different language from ABAP (procedural HANA-specific syntax, its own debugging approach via HANA-side tools), it creates a harder database platform dependency than portable Open SQL or CDS (though this is largely moot for S/4HANA specifically, since S/4HANA requires HANA as its database anyway), and it should be reserved for genuinely performance-critical, computationally heavy logic rather than used as a default replacement for ordinary Open SQL or CDS views, which remain simpler to write, test, and maintain for the majority of everyday requirements.