10-24-2017 8:21 AM
Hi,
I recently noticed a weird behaviour while debugging some custom ABAP coding.
First we thought of some buffer problem with newly generated code. You might have seen the debugger showing you new code while some old code is executed. There might be some odd behaviour then. But when you restart the program everything is fine again.
Now we managed to break down the issue to these few lines:
The debugger stops at line 13. Apparently it shouldn't.
Coding in this line is not executed, so it seems to be a debugger-only problem.
Can anyone explain this? Is this a known issue?
I ran this on SAP Netweaver 7.4.
Thanks & Regards,
Jonathan
For copy/paste:
DATA(lt_laiso) = VALUE laiso_tab( ( 'FR' ) ).
IF 1 EQ 2.
lt_laiso = COND #( WHEN 1 EQ 1 THEN VALUE #( ( 'DE' ) ) ELSE lt_laiso ).
ENDIF.
WRITE: / lt_laiso[ 1 ].
10-24-2017 9:02 AM
If you set a breakpoint, it doesn't stop. If you execute->debugging, then it does stop at that line. However, in all cases, the output is "FR". So it looks like the line isn't, in fact, being executed.
Most odd
Paging horst.keller
10-24-2017 9:43 AM
Found the same (strange) behavior and forwarded to debugger colleagues. -> It is a "Debugga Morgana"
10-24-2017 10:59 AM
This intrigued me so I gave it a quick test.
On 7.5 SP6 it behaves as expected and hits the breakpoint in ADT and SAPGUI.
BUT... then it steps into the IF branch. The value isn't changed so, as Matthew observed, it isn't executed. Morgana indeed.
10-24-2017 11:17 AM
It seems to me that it is something to do with the ELSE statement :). If you move the ELSE statement to the next line, the control jumps to that line and if you remove it, it doesn't get in the IF block at all. Odd anyways!
12-04-2017 2:12 PM
Hey,
I saw this and got curious. In 7.4 SP 13 and up it is working as expected (breaks at line 10, in you example).