‎2010 Sep 14 9:00 AM
Hi ,
I have one internal table in where i am getting some 5000 records from ztable , now from this 5000 records i want to take only few records i.e for example my internal table is
companycode currency
1001 25$
1001 50$
and in the last rows i have
2000 45$
2000 45$
now wht i want is without using select upto i want to select 5 records with 1001 company code and 5 records from 2000.
Please help me out
cheers,
bhavana
‎2010 Sep 14 9:40 AM
Hi Bhavana ,
what you do is make use of at new command in loop endloop.
and while doing that use counter and move data to another internal table till counter is <= 5 and then use that new internal table for further use .
such as
sort itab by company code
data : cnt type i value 1 .
loop at itab .
at new companycode .
while cnt <= 5 .
move corresponding fields of itab to itab1 .
append itab1 .
clear itab1 .
endwhile .
clear itab .
endloop.
do changes according to your requirment .
Regards
Deepak.
‎2010 Sep 14 9:40 AM
Hi Bhavana ,
what you do is make use of at new command in loop endloop.
and while doing that use counter and move data to another internal table till counter is <= 5 and then use that new internal table for further use .
such as
sort itab by company code
data : cnt type i value 1 .
loop at itab .
at new companycode .
while cnt <= 5 .
move corresponding fields of itab to itab1 .
append itab1 .
clear itab1 .
endwhile .
clear itab .
endloop.
do changes according to your requirment .
Regards
Deepak.