Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Get row number in source code

Former Member
0 Likes
2,735

Hello,

I want to combine a breakpoint and a watchpoint to debug a program.

The idea is to set a watchpoint for a variable, but only for a specif line in my source code (combination breakpoint and watchpoint).

I know it's possible to enter conditions for a watchpoint, but I don't know whether it's possible to define the line of the source code in the condition. I did check the system variables, but couldn't find one which keeps the current row of the source code.

Anyone can help me with my problem?

Thanks

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
2,167

HI Glenn

One thing you could do if you don't mind changing the source code is to put this in the line you want



IF variable EQ value.
BREAK-POINT.
ENDIF.

Pushpraj

14 REPLIES 14
Read only

Former Member
0 Likes
2,168

HI Glenn

One thing you could do if you don't mind changing the source code is to put this in the line you want



IF variable EQ value.
BREAK-POINT.
ENDIF.

Pushpraj

Read only

0 Likes
2,167

Unfortunately, it's standard SAP code (with an enhancement spot), so I can't use this one.

Thanks

Read only

0 Likes
2,167

Hi Glenn

Try the fields ABDBG-FLINE and ABDBG-CLINE.

Pushpraj

Read only

0 Likes
2,167

So, what should I enter as condition for my watchpoint?

Something like:

variable = value AND ABDBG-CLINE = 200

Because it says "Unknown variable ABDBG".

Also, when I add the variable ABDBG in my debugger, it's unknown.

Thanks

Read only

Former Member
0 Likes
2,167

If u wan to debug a specific line, then jus gve BREAK-POINT bfore that.

or if ur in a loop and u wan to debug from say only 100th rec, u can gve the cond. as sy-tabix = 100 while setting the watch point.

Read only

0 Likes
2,167

The problem is that it's indeed in a loop, but I have no idea at which record my variable changes to a specific value. That's the thing I want to know.

Read only

Former Member
0 Likes
2,167

if its having a large num of entries in the table..u jus need to chk by the values of sy-tabix while creating the watchpoint. if u hve debuuged it for some time, u might hve got an idea of where exactly the chg might happen.

Read only

Former Member
0 Likes
2,167

Hi,

Use SY-LILLI field.It will give the current line number..

Regards

Kiran

Read only

0 Likes
2,167

I tried this before, but the value doesn't change (it says 0) even when I go through the code by F5/F8.

Thanks

Read only

Former Member
0 Likes
2,167

if u hve the idea of the variable that is being changed.

jus gve the wa-variable = value

and condition as sy-tabix = 100.

if u know to wat value this variable is being chged, u can gve that value in the condition n chk.

Read only

0 Likes
2,167

The program is reading a file, so I can't use sy-tabix.

The file is very big, so there are a lot of loops.

I can keep pushing F8 at the breakpoint to see when the variable becomes empty (the one I need), but it's taking very long to find out where this happens...

Read only

Former Member
0 Likes
2,167

y don u try this.

u say that the variable is being set to blank...right.

so while creating the watch point give this con. variable = ' ' "space

and it will take u to that record when it is being set to blank.

Read only

0 Likes
2,167

That was how I initially did it, but there is also a line in the code that clears the variable.

So when I create the watchpoint, it also stops at this line.

Read only

Former Member
0 Likes
2,167

as uknow the line which clears the variable, instead of watchpoint keep a break point there and press F8. chk at which record this is cleared.