Single step debugging on Macro
I use a quite simple example to demonstrate:
Execute the report, debugger will stop at line 23.
Click this button:
The debugger will automatically show tab as below:
then we can execute the macro code one by one by clicking F5:
the line 22 and 23 just represent the ABAP code CHECK strlen(&1) >= 5.
We observed after macro line 22 and 23 are executed, our internal table lt is still empty. This is working as expected, since now the APPEND statement in Macro code is not executed yet.
The internal table is filled after Macro code 27 is executed.
before Macro code line 28 is executed, <first> is not valid, since the respective ABAP code READ TABLE &2 ASSIGNING <first> INDEX 1. in line 14 is not executed yet.
click F5, now <first> is filled.
After Macro code 33~35 is executed, the string concatenation is done.
Although you can debug Macro this way, it does not mean you should not think twice when you use Macro in your code. There are already plenty of discussion and blog in SCN regarding how to use Macro wisely. Hope this blog helps you when you have to debug some complex Macro in legacy code.