Debugging Part 4: Watchpoints, Layers and Static Checks (ATC)
Preview · a free account unlocks the full lesson
Find where a value changes with watchpoints (variable change, conditions, objects), combine them with breakpoints and the call stack, use layer-aware debugging for standard + custom code, and prevent bugs earlier with the extended program check (SLIN), Code Inspector (SCI) and ATC.
In this lessonShow sectionsHide sections
Visual overview
Explanation
Part 2 covered stepping through code line by line; some bugs, though, are just a value changing somewhere across thousands of lines, and that's exactly what watchpoints are built to find.
A watchpoint stops the debugger the moment a specific variable changes, optionally only when some condition you've set is true, which makes it ideal for answering "who overwrites this field?" Combine a watchpoint with the call stack to identify exactly which program and routine is responsible for the change.
Layer-aware debugging — using a debugger profile with "System debugging" switched off, or configuring software layers — keeps the debugger focused on your own custom code, or on selected packages, rather than stopping everywhere in standard SAP code too.
It's also worth knowing that static checks like SLIN, SCI, and ATC catch a lot of bugs before runtime ever happens — things like dumps from an uninitialized FOR ALL ENTRIES table, missing sy-subrc checks, or performance problems.
To create a watchpoint, go to the Breakpoints tab and choose Watchpoint, or right-click a variable directly and choose "Create watchpoint." The variable can be something like XVBAP-ROUTE, LS_ITEM-NETWR, or even an object attribute. You can attach a condition, for instance LS_ITEM-NETWR < 0 or VBAK-AUART = 'ZOR', so the watchpoint only fires when that's true.
Scope matters too — local versus global variables — and for a global variable belonging to another program, use the (PROGRAM)VARIABLE syntax to reference it. Continue execution with F8, and the debugger will stop right after the statement that actually changed the value.
Create a free account to keep reading
You have read the opening of this lesson. A free ERPClimb account unlocks the rest of it, every other lesson and topic, and your learning history, so you can pick up exactly where you stopped. No card needed.
- Full explanation
- Code example
- Real project scenario
- Common mistakes
- Best practices
- Interview angle
One tap with Google works too. Every topic keeps its first lesson open to everyone.
Keep exploring
Referenced SAP objects
Reviewed reference pages for the objects this page mentions.
Check before use: lesson examples are educational, not a guarantee of correctness for your SAP edition or release. Sample code has not been executed on your SAP system. Confirm API availability, syntax, authorizations and business impact in an approved development or test environment.