Mentor SAP

With ABAP 7.5, an AMDP can be debugged in a fully-integrated way using the ABAP Development Tools. Simply open the AMDP method in an ABAP editor view and set a breakpoint as usual.

 

 

When the program calling the AMDP is executed and the breakpoints are reached, the debug view opens. If breakpoints are set both in unusual ABAP code as well as in AMDPs, two debug sessions are created: an AMDP debugger session and a Database Server session. The latter is the one used for the AMDPs.

 

 

Debugging ABAP-managed Database Procedure in SAP NetWeaver 7.40

 

In earlier ABAP releases supporting AMDPs, procedures can only be debugged using a direct database connection in the SAP HANA studio and so-called external session debugging.

 

 

The ABAP user (ABAPDEV in the figure, involved user Accounts and Authorizations) executing the ABAP application needs the usual authorizations on ABAP level, that is, the authorizations to execute the application, and to debug on the ABAP level if the ABAP code is also to be stepped through.

 

An SAP HANA user (HANADEBUG in the figure) who can access the database and perform the database debugging needs the authorizations to the following:

 

The SAP<SID> user used by the ABAP system to access the database. This user initiates executing the database procedure. Only the SAP<SID> user can grant the HANADEBUG user the permission to attach a debugger to SAP <SID> user sessions, and this user can also grant permission to execute and debug the procedure.

 

The SQL grant statements to be executed on the SAP HANA level (as SAP<SID> user) for ABAP-managed database procedure AMDP_NAME in ABAP system SAPT85 are

 

GRANT DEBUG ON “SAPT85”. “AMDP_NAME”

TO HANADEBUG;

GRANT EXECUTE ON “SAPT85”. “AMDP_NAME” TO HANADEBUG;

GRANT ATTACH DEBUGGER to HANADEBUG;

 

Alternatively, the grant statements for the authorization to debug any ABAP-managed database procedure in the schema SAPT85 are as follows:

 

GRANT

DEBUG ON SCHEMA “SAPT85” TO HANADEBUG;

GRANT EXECUTE ON “SAPT85”. “AMDP_NAME” TO HANADEBUG;

GRANT ATTACH DEBUGGER to HANADEBUG;

 

 

 

To prepare the debugging session, perform the following steps:

SAP HANA system:  the connection of the HANA user used for debugging, HANADEBUG in the example. 

HANA user: the SAP<SID> user, SAPT85 in the example

Application user: The ABAP user, ABAPDEV in the example

 

The debug thread does not execute the database procedure and stops at a breakpoint. Instead, the thread waits for the HANA user entered in the debug configuration to initiate a database session and hit a breakpoint. Only then will the thread attach to the HANA user’s session and debugging begin.

 

 

To begin debugging, start the ABAP application using the ABAP user entered as Application User in the Debug Configuration. Application execution will stop once the first breakpoint in the database procedure is reached.