Sie sind auf Seite 1von 8

Mar 15, '08 8:27 PM

SAP Debugging Tutorial for everyone


1st part: Setting up break-points.

3 ways!

If the program that you want to debug is not editable / can only be presented in display mode / has a blue
back-ground, one may use this “STOP” / break-point button.

For example: We are going to set up break-points upon execution of a selection, and on the turn of calling a SAP
standard function module.

Note: One can set more than one break-points in a program.

Position your cursor on the line where you’d like to set a break-point at and click the break-point button (shown
above). For this example, the cursor was positioned at the line “START-OF-SELECTION” and the break-point button
was pressed. The same was done for the line containing the words “CALL FUNCTION
‘TRCA_COMPANYCODE_GETDETAIL’ “. Break-points are now represented as highlighted points in the program as
shown in this picture.

Another way of doing so is by inserting a “break-point.” command in the program like this:
The
least popular way of setting or deleting break-points is by going though this:
Utilities > Breakpoints > Set/Delete. ( Ctrl+Shift+F12 )

2nd part: Deleting Break-points.

For “typed” break-point commands, simply erase by backspace or delete the “break-point.” command. For highlighted
break-points, just position the cursor on that line and press the break-point button again from the toolbar, or one may
even go to the utilities part in the menu bar.

3rd part: Using break-points.

Commonly used keys in debugging mode: F5 – single step;


commonly used for watching values or thorough step by step process
F6 – almost the same with single step but skips sub-routines
F7 – for forwarding to the next break-point or finishing a loop
F8 – run execution

This is the example that we’re going to use:


Using my own example, these are the sample input parameters to be used
for the rest of the lecture:

Now, upon execution of the selection screen, SAP will


forward to the debugging screen

Okay, at this point, s_bukrs-low s_rfha-low and the rest of the field names
on the lefts side have no value yet. Once the abap debugger arrow proceeds to the next line, s_bukrs-low will have
the value of p_bukrs ( in this example is Company Code 1058 ).
Observe. (processed by single step or F5)

After pressing F5, s_bukrs-low acquires the value of p_bukrs,


and the debugger cursor moves to the next line.

From this point, pressing F7 will forward you to the next break-point.
Now, since we’re about to process a SAP standard function
module, we have a choice to skip this part and proceed to the rest of the program (by pressing F6), or continue
viewing the process of this function module (by pressing F5).

Note: if by anytime you want to skip the debugging mode, just press F8.

Pressing F5 you’ll have a view of a SAP standard function module processing, notice the main program and source
code.

From this point, if one wishes to proceed debugging the SAP


standard function module, press F5; If one wishes to pick-up from where we left debugging the main program, simply
press F7 and you’ll go to the next line of the program after the “Call Function ..” statement.
Part 4: Other notes

Notice that there are other tabs beside “Field” in the debugger.

This is for the “Table” tab:

Herein are the contents of the internal table t_ftr. One may manipulate
the current view of the data by choosing the fields he/she wishes to see, but this doesn’t change the actual structure
of the internal table.

The encircled portion on the bottom right expands the table upwards (if one’s having difficulty looking at an internal
table with many line items).

If one wishes to see the other fields in the table, simply press Shift+F7 to scroll to the right or Shift+F6 to scroll to the
fields on the left. Press Shift+F5 to go back to the original view.

For the breakpoints tab etc:


If one wishes to skip the debugging mode, and continue processing the program, go to:

If one doesn’t want to continue processing the program, go to: Debugging>Exit (Shift+F3).

IMPORTANT:!!!

Never forget to delete your break-points after you’ve finalized your program :D

Hope you learned a thing or two.