‎2009 Jan 12 10:03 AM
hi,
how to find whether a statement exists between loop and endloop.
for eg:
loop at itab.
clear.....
endloop.
want check whether clear statement exists between loop.
Thanks
‎2009 Jan 12 10:15 AM
Hi Selvaraj,
in the following code, sy-tabix vary from 1 to 10... but it doesnot mean there is a statment inside loop.
data: itab like tstc occurs 0 with header line.
select * from tstc into table itab up to 10 rows.
loop at itab.
regards,
Venkatesh
endloop.
‎2009 Jan 12 10:05 AM
‎2009 Jan 12 10:05 AM
Hi,
I am not sure what exactly you are looking for.....
We can check out whether the table is getting looped or not by checking out the sy-subrc value.
Why do you need to find out whether there is a statement in side a loop.
Regards,
Venkatesh
‎2009 Jan 12 10:11 AM
Hi,
If u r debugging the code,
Check ur SY-TABIX value,
if it is changing continuously like 1, 2, 3,.........etc.
then ur statement inside the loop.
‎2009 Jan 12 10:15 AM
Hi Selvaraj,
in the following code, sy-tabix vary from 1 to 10... but it doesnot mean there is a statment inside loop.
data: itab like tstc occurs 0 with header line.
select * from tstc into table itab up to 10 rows.
loop at itab.
regards,
Venkatesh
endloop.
‎2009 Jan 12 10:26 AM
Hi venkatesh,
I'm not saying that , if sy-tabix varies, it will contain some statements.
I said that If ur cursor on a particular statement, now u want to find out that statement whether in loop or not.
‎2009 Jan 12 10:16 AM
>
> hi,
>
> how to find whether a statement exists between loop and endloop.
> for eg:
> loop at itab.
>
> clear.....
>
> endloop.
>
> want check whether clear statement exists between loop.
>
> Thanks
Can't you just read the code?
‎2009 Jan 12 10:17 AM
Instead of Clear statement in Loop and Endloop you can move some value by defining some local variable.
You can verify the veriable by checking the value of variable ...
e.g.
Data : l_check(20) Type C.
Loop at ...
l_check = 'Test Move'.
Endloop.
If the value of variable is 'Test Move' then your purpose will be solved... You can check this by debugging
‎2009 Jan 12 10:27 AM
Hi...
Using the read report statement you can get the source code.
then you can check the condition.
Ex. READ REPORT sy-repid INTO i_source.
‎2009 Jan 12 10:49 AM
hi,
we can use read report but how i will know that clear statement exists between loop.
‎2009 Jan 12 10:57 AM
If you want to find that Clear Statement is whithin the loop or not.
Just debug the code, IF sy-subrc EQ 0 that means loop is working . And when you are within the Loop, just debug it line by line thru F5 you will get to know all the Statements within the loop.
‎2009 Jan 12 11:07 AM
hi,
i dont want to check in debug mode.
i am reading a report and checking whether clear statements exists with in a loop.
i want to check and capture that code line which exists between loop and endloop.
‎2009 Jan 12 11:12 AM
You should have mentioned this in your original question to avoid inappropriate answers.
regards,
Advait
Edited by: Advait Gode on Jan 12, 2009 12:13 PM
‎2009 Jan 12 11:14 AM
‎2009 Jan 12 11:07 AM
Hi,
In debugging the code , and check the sy-tabix .
Regards,
Madhu
‎2009 Jan 12 11:10 AM
hi,
i am writing a report which should read another report and check clear statements exists between loop.
i am not talking about debug mode.
‎2009 Jan 12 11:36 AM
Take the report into one Internal table say t_source1 using below statement.
Reading Report to delete the comments
READ REPORT p_pgname INTO t_source1.
Get all the includes of the program into an internal table
CALL FUNCTION 'GET_INCLUDETAB'
EXPORTING
progname = p_pgname
TABLES
incltab = i_incl_tab.
IF NOT i_incl_tab[] IS INITIAL.
Loop at this internal table and append all the data to
Main Report table
LOOP AT i_incl_tab INTO wa_incl_tab.
READ REPORT wa_incl_tab-line INTO t_source_tmp.
APPEND LINES OF t_source_tmp TO t_source1.
REFRESH t_source_tmp[].
CLEAR wa_incl_tab.
ENDLOOP.
ENDIF.
Now LOOP AT t_source1 INTO wa_source1 ..... This t_source1 is an internal table with all the lines including all subroutines.....
You can read the table line by line with Key word LOOP and once find then you can find the required Statement ....
Include one more condition... If you find a Keywork ENDLOOP then it means your required statement does not exist in LOOP and ENDLOOP..... if found then you can set a Flag....
Thanks,
Amol
I think this will solve your purpose.
‎2009 Jan 12 1:12 PM
‎2009 Jan 12 4:24 PM
Actually, I think there is no good way. Within a LOOP/ENDLOOP, there may be calls to other forms, function modules, external performs.
Rob
‎2009 Jan 12 4:36 PM
If you're wondering if a certain variable is changed, you might try using the debugger and a watchpoint.
‎2009 Jan 12 4:40 PM