ABAP Managed Database Procedures are a framework for managing and calling stored procedures or database procedures. AMDP is a procedure written in a database-specific language ( Native SQL, SQL Script) implemented in an AMDP method of anAMDPclass.
By using AMDP, we want to achieve complete pushdown of transformation execution as the logic will be executed on the database layer instead of on the application layer.
Activating the AMDP Debugger
To debug any ABAP Managed Database Procedures, open the object that you would like to debug. Before moving ahead, you must first activate the AMDP Debugger in an ABAP project before using it.
1. Explicit activation of the Debugger
To activate the AMDP Debugger explicitly, position the cursor within the ruler (left bar) of the source editor at the line that contains the AMDP code and choose “Activate AMDP Debugger” from the context menu.
2. Implicit activation of the Debugger by setting Breakpoint:
You can set the breakpoint by double-clicking the line that contains the executable statement or by position the cursor and by choosing the “Toggle Breakpoint” from the context menu. Note that there will be two AMDP classes (A & M) generated. M class are not considered for DTP execution. AMDP Breakpoints must be set in the A-class instead.
Since the current activation state of the AMDP Debugger is quite important it is also reflected by the colour of the breakpoints:
- Grey – Debugger is inactive
- Green – Debugger is active, Breakpoint is confirmed
- Blue – Debugger is active, Breakpoint confirmation is pending
1. Once the breakpoint is set, you can go ahead and trigger the DTP. This will, in turn, open the Debugger Perspective and stops at the breakpoint. Now we can use the tools provided by the SQL Script Debugger.
2. You can see the list of active breakpoints from the Breakpoints tab.
3. We have icons/buttons in the top-left corner in the debugger perspective to help us to navigate through the source code.
|Resume||Run to the next AMDP breakpoint or end the program|
|Terminate||Cancel the debugger and the debugged application as well|
|Disconnect||Cancel the debugger while the application resumes execution|
|Step Into (F5)||Execute the next single statement in the program|
|Step Over (F6)||Execute the next statement and if the next step is a procedure call, run the entire procedure|
|Step Return (F7)||Run until the current procedure returns to its caller or until the program ends.|
|Run to line (F8)||Run to the statement on which the cursor is positioned|
4. In the Variable tab, you can see the Variables filled with values. However, we were not able to change the value of the variables as in the case of the traditional ABAP debugger. Now the OutTab is also visible and contains 0 records as the control is at the first breakpoint at line 80.
5. For the Control execution to go to the next breakpoint, press F6. Now you can see the control is at line 85 and the Variable OutTab is shown in the Variable list and contains 17 rows.
6. We can see the data of InTab and OutTab by double-clicking on the table and you can notice that our code is working as per logic to set a value as “DEBIT” when the indicator is “S”, else “CREDIT”.