Skip to Content
0

how to put a breakpoint at a particular text in program while debugging

Jan 25, 2017 at 07:11 AM

287

avatar image

hello all,

while debugging , suppose i want stop my debugger at a position where there is some text

like 'Please Check the LOC No' (which is coded is my program as if sy-subrc = 4.

message 'Please check the LOC No' type 'E'.

and there is no message number assigned for this error message..

how do i force stop my debugger at this particular point..

in my system there is no option break point at->message

thanks in advance..

debug1.jpg (234.7 kB)
10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

5 Answers

Best Answer
Sandra Rossi Jan 25, 2017 at 07:37 AM
3

The message number 001 of message class 00 is implicitly used to map the text. Try setting a watchpoint on "SY-MSGNO = '001' "

Show 5 Share
10 |10000 characters needed characters left characters exceeded

Ooo - I never knew that! :-)

0

Hi Sandra,

per SAP documentation -

For compatibility reasons, this variant can still be used for classes that only implement the interface IF_MESSAGE. In this case, the interface methods GET_TEXT and GET_LONGTEXT are called automatically in the referenced object and their return value is used as the short text or long text of the message. In this case, the system fields sy-msgid and sy-msgno are not filled specifically.

What am i missing here? :-/

BR,

Suhas


0

The documentation you refer to is relevant for message statements that use object references (section "Alternative 4"). I think the original question was how to stop at message statements that use text literals.

2

Gotcha... My bad!

1

hi sandra,

thanks for your solution, now i am able to force stop the debugger at any message text,

is this the only method or is there any other way by which we can force stop the debugger.

thanks and regards,

vinay..

0
Armin Beil
Jan 25, 2017 at 02:44 PM
3

To stop at each and every message statement you can create a statement breakpoint as already mentioned by Peter. To do that: Start the debugger, press Shift-F5, enter 'message' and confirm.

If you want to stop only at message statements that use text literals and not if they use message classes (as described in your original question) then Sandras solution is great and I think you won't find a better one.

If you have even more complicated requirements, e.g. stop only if a special literal occurs, then a custom debugger script might be helpful but that would be much more effort. The script would have to fetch the current source line...

Share
10 |10000 characters needed characters left characters exceeded
Peter Inotai Jan 25, 2017 at 10:25 AM
1

Is "Breakpoint at statement" with statement MESSAGE not an option?

Share
10 |10000 characters needed characters left characters exceeded
VINAY REDDY Jan 26, 2017 at 12:04 PM
0

hi armin,

in my system there is no option for message,

i think i should go with sandras solution..

thanks and regards,

vinay.


d1.jpg (183.5 kB)
Show 1 Share
10 |10000 characters needed characters left characters exceeded

You nearly made it. ABAP Cmnds is the right tab. <Enter 'message'> means enter the text 'message' as first row entry into that table that is visible on your screenshot.

But as mentioned that will stop at each and every message statement while Sandras solution is better if you only want to stop at those message statements that use literals.

2
VINAY REDDY Jan 27, 2017 at 10:19 AM
0

Hi Armin Beil,

got your point,

thanks for your reply..

Note : unfortunately there is no Helpful Answer option in new platform, i hope the community designers would add this option in coming days..

thanks and regards,

vinay..

Share
10 |10000 characters needed characters left characters exceeded