AMDP Part 3: Procedures, Functions and Table Function Implementations
Preview · a free account unlocks the full lesson
Know the three kinds of AMDP methods — procedures, scalar/table functions and CDS table function implementations — their syntax, how they are called, and when to use each.
In this lessonShow sectionsHide sections
Visual overview
Explanation
An AMDP procedure is called from ABAP like a method and can have several IMPORTING and EXPORTING parameters. An AMDP function, declared BY DATABASE FUNCTION, returns a single result and is meant to be called from other AMDPs rather than directly from ABAP. A FOR TABLE FUNCTION implementation backs a CDS table function and is consumed through that CDS entity. You can reuse SQLScript logic by calling AMDP functions or procedures inside other AMDPs, listing them in the USING clause.
Part 2 built a single procedure; AMDP actually offers three flavors, and picking the right one is what keeps the code reusable.
The AMDP procedure uses the syntax METHOD m BY DATABASE PROCEDURE FOR HDB LANGUAGE SQLSCRIPT, optionally with OPTIONS READ-ONLY, followed by USING. Its signature consists of IMPORTING, EXPORTING and CHANGING parameters, all passed BY VALUE, with no RETURNING parameter. It's called from ABAP exactly like any static or instance method — zcl_x=>m( EXPORTING … IMPORTING … ) — and can read, and without READ-ONLY even write, database tables, though writing is rare and needs strong justification. A procedure can also call other AMDP procedures.
Create a free account to keep reading
You have read the opening of this lesson. A free ERPClimb account unlocks the rest of it, every other lesson and topic, and your learning history, so you can pick up exactly where you stopped. No card needed.
- Full explanation
- Code example
- Real project scenario
- Common mistakes
- Best practices
- Interview angle
One tap with Google works too. Every topic keeps its first lesson open to everyone.
Keep exploring
Interview questions on this topic
Check before use: lesson examples are educational, not a guarantee of correctness for your SAP edition or release. Sample code has not been executed on your SAP system. Confirm API availability, syntax, authorizations and business impact in an approved development or test environment.