ERPClimb logoERPClimb

SAP RAP / CDS / OData AMDP Interview Questions

AMDP comes up in SAP RAP / CDS / OData interviews because it is one of the few areas where an interviewer can tell, in two questions, whether you have worked with the process or only read about it.

Learn ABAP Managed Database Procedures as a controlled way to execute SQLScript on SAP HANA from ABAP. Focus on AMDP methods, table functions, pushdown use cases, lifecycle, testing, performance evidence and the situations where simpler Open SQL or CDS is the better choice.

This page carries 12 reviewed SAP RAP / CDS / OData amdp interview questions, each with a complete written answer and no sign-in required. The set breaks down into 1 foundational, 6 mid-level and 5 advanced questions, so you can start at the top for a first interview or skip ahead to the scenario-based items for a senior round.

The fastest way to use this page is to read the question, answer it yourself, and only then read the answer. The gap between your version and the written one is your actual revision list for amdp.

12 AMDP questions with answers

easyAMDP

1. What is AMDP, and where does it fit among the code pushdown options?

AMDP is an ABAP class method (class implements if_amdp_marker_hdb) implemented in SQLScript via BY DATABASE PROCEDURE/FUNCTION FOR HDB, with a USING clause for all read objects; the ABAP runtime creates and manages the HANA procedure and it is transported with the class. Pushdown order: ABAP SQL for program logic, CDS view entities for reusable models, AMDP only for multi-step SQLScript, HANA-specific functions, CDS table function implementations or measured performance needs.
mediumAMDP

2. What are the key clauses you expect in a basic HANA AMDP method and what does each one do?

I expect the class to implement IF_AMDP_MARKER_HDB. The method implementation uses BY DATABASE PROCEDURE, FOR HDB and LANGUAGE SQLSCRIPT. OPTIONS READ-ONLY is appropriate for a read-only example, and USING declares the database objects referenced by the SQLScript. Host variables are referenced with a colon.
mediumAMDP

3. Three AMDP procedures contain the same SQLScript block with slight differences, and reports show inconsistent numbers. What do you do?

Extract the shared logic into one AMDP table function (READ-ONLY, RETURNING), agree the correct definition with the business, and call it from the three procedures (listed in their USING). Add ABAP Unit tests comparing results, and consider whether the logic should instead be a CDS view or CDS table function used by all consumers. Measure performance before and after.
mediumAMDP

4. A nightly job calling an AMDP dumps occasionally with a database error. How do you analyze it?

Read the ST22 dump (CX_AMDP_* with HANA error text). Log the input parameters before the call to reproduce. Reproduce in DEV/QAS with the same input, set a breakpoint in the SQLScript with the ADT AMDP debugger and inspect table variables to find the failing step (e.g. conversion of bad data, division by zero). Fix the SQLScript (safe conversion, filters) and/or data, catch CX_AMDP_EXECUTION_ERROR in the caller with meaningful logging, and add a unit test for the case.
mediumAMDP

5. A guideline requires all reporting logic in AMDP "for HANA performance". How do you respond?

Challenge it with evidence: ABAP SQL and CDS are already pushed down to HANA; for simple selects, joins and aggregations they perform the same, are portable, easier to test and maintain. Propose "ABAP SQL/CDS first, AMDP with justification" (multi-step logic, HANA-specific functions, table function implementations, measured gains). Compare a sample of existing AMDPs against CDS/ABAP SQL with ST05, and replace simple ones during regular changes.
mediumAMDP

6. Explain the difference between AMDP procedures, AMDP functions and FOR TABLE FUNCTION methods.

Procedures (BY DATABASE PROCEDURE) are called from ABAP, with IMPORTING/EXPORTING/CHANGING parameters passed by value, no RETURNING; they can call other AMDPs. Functions (BY DATABASE FUNCTION, OPTIONS READ-ONLY, RETURNING) are used inside other AMDPs' SQLScript and must be listed in their USING — not callable from ABAP. FOR TABLE FUNCTION methods implement CDS table functions; their signature comes from the CDS definition and they are consumed via the CDS entity by ABAP SQL, CDS or OData.
mediumAMDP

7. Can AMDP be used in ABAP Cloud, and what are the restrictions?

Yes. In ABAP for Cloud Development, AMDP is available on HANA, but the USING clause may reference only own objects and SAP objects released with contract C4 (use in AMDP) — SAP tables are rejected. Reason: SQLScript accesses database objects directly, so SAP must guarantee their structure. AMDP must not write SAP data (use released APIs), and it does not apply authorization or DCL — check in ABAP or wrap in a DCL-protected CDS view. Keep dependencies minimal and tested.
hardAMDP

8. You inherit 25 AMDP classes. What do you review?

Justification per AMDP (could CDS/ABAP SQL do it?); USING lists (SAP tables vs own/C4 objects); client filters on every client-dependent source; READ-ONLY and absence of writes to SAP tables; set-based SQLScript without cursors; NULL handling; parameter design; error handling in callers; authorization; tests; performance measurements; documentation. Prioritize data-integrity risks (writes, missing client filters) first.
hardAMDP

9. How do you pass internal tables to an AMDP and handle client and NULL values correctly?

Declare IMPORTING VALUE(it_keys) with a flat line type; in SQLScript it is a table variable joined as :it_keys — better than dynamic IN lists. Outputs are assigned (et_x = SELECT …). Client: filter every client-dependent table with SESSION_CONTEXT('CLIENT') (or a client parameter); for CDS views use the CDS SESSION CLIENT option. NULLs from outer joins/aggregates: use COALESCE. Test empty inputs and keys without data.
hardAMDP

10. A report is slow because it aggregates millions of rows in ABAP. Would you move it directly to AMDP?

Not automatically. I would measure the bottleneck, then first test whether modern Open SQL or CDS can perform the set-based aggregation cleanly. AMDP is justified when SQLScript or HANA-specific processing provides a measurable benefit that higher-level ABAP/CDS cannot deliver cleanly. I would compare correctness and runtime with realistic data before accepting the HANA-specific coupling.
hardAMDP

11. What are your design rules for AMDP in a clean-core S/4HANA project?

Use AMDP by exception with documented justification; read-only; USING only own or C4-released objects; minimal dependencies; explicit client handling; set-based SQLScript with table variables; reusable AMDP functions for shared logic; CDS table functions when results feed services/analytics; authorization in ABAP or DCL wrappers; catch and log AMDP exceptions; ABAP Unit tests and performance measurements; ATC checks; periodic review for CDS replacements.
hardAMDP

12. How do you test and tune AMDP code?

Testing: call the AMDP through its ABAP method in ABAP Unit with stable test data; compare with an ABAP SQL reference; cover empty input, NULLs, client isolation and boundaries; or wrap logic in a CDS table function and use the CDS Test Double Framework. Tuning: ST05 for statement time and rows, SAT for AMDP vs ABAP share, PlanViz/explain plan for the costly operator; filter early, avoid cursors/loops, reduce columns, avoid functions on join columns; measure before/after with realistic volumes.

Related lesson

AMDP Part 5: Debugging, Testing and Performance Analysis

Related topics

Next practice step

Go deeper on this topic