2010 Jan 19 4:06 PM
Hi
My problem is perhaps best illustrated in this small program:
REPORT zzkc_watchpoint.
PERFORM form1 USING 'AB'.
PERFORM form1 USING 'CD'.
PERFORM form1 USING 'EF'.
PERFORM form1 USING 'GH'.
FORM form1 USING value(p_1).
DATA: lv_local(3) TYPE c.
IF 1 > 2. <----
Watchpoint triggered here - regardless of condition
ENDIF.
lv_local = p_1.
IF 1 > 2. <----
And here when condition is met.
ENDIF.
ENDFORM
I set a conditional watchpoint (all Module Instncs) on variable lv_local, condition: lv_local = 'EF', BUT: The watchpoint is whenever form form1 is entered. It's also triggered when lv_local eventually is set to 'EF", but why is it triggered upon entering form1???
Best regards
Kenneth
Hi
My problem is perhaps best illustrated in this small program:
REPORT zzkc_watchpoint.
PERFORM form1 USING 'AB'.
PERFORM form1 USING 'CD'.
PERFORM form1 USING 'EF'.
PERFORM form1 USING 'GH'.
FORM form1 USING value(p_1).
DATA: lv_local(3) TYPE c.
IF 1 > 2. <----
Watchpoint triggered here - regardless of condition
ENDIF.
lv_local = p_1.
IF 1 > 2. <----
And here when condition is met.
ENDIF.
ENDFORM
I set a conditional watchpoint (all Module Instncs) on variable lv_local, condition: lv_local = 'EF', BUT: The watchpoint is whenever form form1 is entered. It's also triggered when lv_local eventually is set to 'EF", but why is it triggered upon entering form1???
Best regards
Kenneth
2010 Jan 19 10:27 PM
This happens because the visibility of local variable is only in the subroutine. When system calls the subroutines subsequently, it reassigns the content of the local variable. If you watch the watchpoints (Watchpoints tool in the Break/watchpoints), you will see that for each subsequent call, system creates a new data reference and assign it to the Current Variable and Old variable. And it has the similar content (blank value) in the Current Value & Old Value.
FORM form1 USING value(p_1).
DATA: lv_local(3) TYPE c.
IF 1 > 2. " At this point, Current Value and Old Value in the Watch points are same, BLANK.
ENDIF.
lv_local = p_1. " here, After this statement Current Value would change to value of the P_1
IF 1 > 2.
ENDIF.
ENDFORM.
If you change the variable scope by changing it as the STATICS, it would only stop when it reaches to the EF.
Check the last section:
http://help.sap.com/saphelp_erp2005/helpdata/EN/f1/792442db42e22ce10000000a1550b0/frameset.htm
In the OLD debugger, as soon as the validity of the variable changes, system would remove the watch point on that variable.
Regards,
Naimesh Patel
2010 Feb 01 7:48 AM
Hi Naimesh
Thank you very much for this explanation - and sorry for getting back so late, but I was under the impression that I would receive an email when there was activity on this thread!!??
BUT I still don't quite get why the debugger stops when entering the routine since the condition specified in the watchpoint isn't fulfilled - ie. lv_local is NOT = 'EF'??
Best regards
Kenneth
2010 Feb 01 7:59 AM
Hi Kenneth,
REPORT zzkc_watchpoint.
PERFORM form1 USING 'AB'.
PERFORM form1 USING 'CD'.
PERFORM form1 USING 'EF'. " ===> ****
PERFORM form1 USING 'GH'.If you are expecting that the watchpoint will stop the control at the above marked location, then thats not possible with the lv_local watchpoint. Instead you will have to put a breakpoint at above location - no need of watch point.
Answering your question, the reason why it didnt stop at above point & stopped inside the subroutine is because the variable is local which means the existence of the variable is limited only to the subroutine. Outside the subroutine such a variable doesnt exist ( you may try using it in your main program & you will get an error msg. ).
Thanks,
Best regards,
Prashant
2010 Feb 01 8:40 AM
Hi Prashant
I know about the scope of the variable, but shouldn't the debugger be able to figure that out and only stop when the condition is fulfilled.
And, in the real world program, the actual subroutine is call (aprx.) 2000 time, so setting a breakpoint is not really an option since the interesting part of the code is only triggered for one of these 2000 calls.
Best regards
Kenneth
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |