Skip to Content
Former Member
Mar 07, 2006 at 02:44 AM

help in looping


Hi Experts,

I am not getting output properly. it should write struct1 value whenever Tcode not equal to FS00 and FSp0. it should write itab_t001 value whenever Tcode equal to FS00 and FSp0.

1.Its working fine whenevr tcode not equal to FS00 and FSp0.

2.also its working fine whenever tcode equal to FS00 and FSp0. first looping (itab_t001) time its writing itab_t001 value when Tcode eq FS00 .then second time looping its writting so many values when tcode eq FS00 .

3.I think the problem may be here

"append lines of it_t001 to itab_t001."

can anyone help me to get exact result.

loop at struct1.

if struct1-tcode = 'FS00' Or struct1-tcode = 'FSP0' .

w_KTOPL = struct1-objectid(4).

select bukrs KTOPL from t001 into table it_t001

where KTOPL eq w_KTOPL.

check sy-subrc eq 0.

if struct1-TCODE eq 'FS00'.

append lines of it_t001 to itab_t001.

clear it_t001.

loop at itab_t001 where KTOPL eq w_KTOPL..

struct1-bukrs = itab_t001-w_bukrs.

append struct1.

clear struct1.