SAP Tips – Debugging technique

We know we can use “/h” in transaction code (command field) box to debug. Then step through the code to find a bug. If you have a problem locating the cause of the bug, you can use this basic technique;

  1. Transaction  /h
  2. Then, step through by pressing F6 until the error is found. (count how many times you press F6.) for example 5 times.
  3. Then re start the process and step through by pressing F6, 1 time less than before, for example 4 times, then press F5, and step through until you find the error.

Sometimes you may be able to use the F7 (return), depending on the source code. If F7 is available to be used, use the following process:

  1. Transaction  /h
  2. Then, step through by pressing F7 until the error is found. (count how many times you press F7.) for example 3 times.
  3. Then re start the process and step through by pressing F7, 1 time less than before, for example 2 times, then, step through by pressing F6 until the error is found. (count how many times you press F6.) for example 5 times.
  4. Then re start the process and step through by pressing F6, 1 time less than before, for example 4 times, then press F5, and step through until you find the error.

Other Debugging tips:

Breakpoint – will stop the program from running at this point, it is set per user ID.

Watchpoint – a great tool which will automatically stop the running of the program if the value of a variable changes. You can use this for example to set when the value of VBAP-MATNR=abc.

You can also use the New Abap Debugger – select Debugging–>Switch to New Abap Debugger – available from ECC 5.0

7 Comments

  1. tung ho September 2, 2011 at 4:43 pm · Reply

    helpful

    • admin September 5, 2011 at 3:37 pm · Reply

      cool

  2. DSRAJPUT October 7, 2011 at 9:30 am · Reply

    This debug tech is really helpful…

    • admin October 7, 2011 at 12:39 pm · Reply

      Great to know! Thanks for your feedback.

  3. beezu November 4, 2011 at 10:12 am · Reply

    really helpful.

  4. Robin Ferali May 3, 2012 at 2:33 am · Reply

    Hello Glynn,

    to go faster to determine reason of an error message, i proceed as follow:
    1) transaction /h
    2) I set a breakpoint for the statement “message” to have the program stopped at each messages. once I stop on my error message, I set a manual breakpoint at the begining on the form or module function and relaunch the program
    3) I look for the reason of the error with F5.

    You can check as well the Call and/or Overview screen to see what were some values upstream and set breakpoints.
    So many things we can do to debug a program… :-)

    • admin May 3, 2012 at 7:54 am · Reply

      Hi Robin,

      Thanks for the tip, it is a good idea to set a break-point at the beginning of the form or Function module which calls the message. Funnily I used to only set it at the message and then read backwards….painful. :)

Leave a Reply