How to Start the Debugger
We start the debugger in order to debug (detect and remove) any issue. The easiest way to start a debugger is via inserting '/h' into the command field. We can insert it either in the beginning (before calling a transaction) or within a transaction where the command field is accessible.
Now when we press 'Enter' we will get the following message in the information task bar:
The debugger will start when we carry out the action
Start an ABAP Report via Debugger
Now in order to debug a report, we can use transaction code SE38. There will be a button in transaction SE38 for starting the debug process.
Start to debug a Function Module
In order to debug a function module, we can use t-code SE37 and then press the Button 'Single Test'.
Now in the function module interface please fill in the parameters and press the button 'Debugging'.
While debugging complicated processes in case if we think that the root lies in a particular function module then we can get the interface parameters and therefore we will be able to perform debug that particular function using the specific interface parameters.
The specific interface parameters will be stored in the function builder test framework and we can call it up in t-code SE37.
Breakpoints
Breakpoint is of three different types:
We can set debugger breakpoints inside the debugger. These exist as long as the debugger is active and gets deleted as soon as we leave the debugger. Depending on our needs in the debugger we can set breakpoints on statements, subroutines, function modules, methods, etc..
Once we save the breakpoints in the debugger using the 'Save' button the breakpoints will be converted to another type of breakpoints known as session breakpoints. These breakpoints will remain active as long as we are logged into the system.
Other possibilities for creating session are
Transaction SE38 for programs/reports:
The breakpoints will be set where we will position our cursor. Therefore double click the left column where we see the breakpoints will also generate new breakpoints.
Transaction SE37 for function modules:
The debugger should start automatically transaction SE37 or SE38 when the breakpoint is reached during your process (e.g. running a transaction).in
The last and third type of the breakpoint is user breakpoints also known as external breakpoints. The user breakpoints are stored in the SAP database and are valid for all logon sessions for the current user on the current server.
Transaction SE37 and SE38 have external breakpoints beside the button for session breakpoints. If we set a breakpoint inside a Web Dynpro or BSP application then the breakpoint will automatically get set.
Watchpoints
We can create a watchpoint for any variable. For example watchpoint can be set on a structure table, single field of the table, etc. It can also be specified that the system should stop only when a variable gets a particular value. We can create watchpoints by using button 'Watchpoint' in the debugger or on the relevant tab.
Navigation In The Debugger
Following are the highlighted buttons from the left to the right:
- Step into (Single step): F5: The current ABAP-statement will be executed when a subroutine, function module, transaction etc. is called by this statement and the debugger will enter into that.
- Step over (Execute): F6: The current ABAP-statement will be executed without entering into a function modules or subroutines.
- Step out (Return): F7: The current ABAP function module or program will be executed and then jumping back to the calling program section.
- Continue F8: This button will execute complete coding and the debugger will stop only when the breakpoint or a watchpoint is reached.
Advanced Navigation Possibility
Goto statement
The cursor can be set on the target source line using 'Goto statement' from the debugger menu. It will not at all execute the coding between the current position and the selected statement. This functionality can be used to check whether a user exists is the root cause for system behaviour which we are experiencing.
Note: This function should be used carefully as use this function changes the standard execution flow of the program.
We need to have the necessary authorization in order to use this functionality.