Debug with a question in mind

Debugging is not random clicking. Start with a question: Does the total become 8 after the two quantities are added? In your own ABAP development environment, set a breakpoint at a meaningful point and inspect the relevant variable.

Follow the value

DATA(total) = 0.
LOOP AT quantities INTO DATA(quantity).
  total = total + quantity.
ENDLOOP.

For quantities 3 and 5, trace the accumulator:

Moment total
Before the loop 0
After the first row 3
After the second row 8

If the value is wrong, inspect the input row and accumulator at each iteration. A watchpoint or breakpoint can help answer a focused question in a real debugger; the exact tools and steps vary by environment.

A simple debugging routine

  1. Reproduce the issue with a small input.
  2. Set a breakpoint before the calculation or at the suspected branch.
  3. Step through and inspect the values that determine the result.
  4. Change one thing, then repeat the same check.

This webpage provides a trace and quiz only. It does not compile code or open an SAP debugger.

Sources

Developer practice · ABAP

Practice: predict the value at a breakpoint

The loop processes quantities 3 and 5. At the breakpoint after the loop, what total is shown? Choose the answer, then check.

1. After adding quantities 3 and 5, what is total?

2. Where should a breakpoint go to inspect the final total?

3. Does this browser exercise start an SAP debugger?