‎2008 Jun 13 4:16 AM
Hi,
I have a requirement like this.
I have an internal table with just one row, lets say "orderid". Now in my scenario, I fill this orderid's which can be repeating, like for eg. it can have same orderid n number of times.
But I also have a requirement like this. I have a condition variable lets say "Count" which will be dynamically passed by the user.
Now i want to fetch all the orderid's from the internal table and store it into a different table which is exactly repeated "Count" number of times. So get all the orderid's from the internal table which is exactly present count times.
Can anyone tell me if I can do this by writing a select query or by using any other efficient method, if possible with some explanation.
Thanks,
Siva.
PS: Points will be rewarded.
‎2008 Jun 13 4:25 AM
hi siva,
data : begin of itab occurs 0.
data : project like zmytable-project.
data : cnt type i.
data : end of itab.
Select project count(*) as cnt
from zmytable
into table itab
group by project
i think this will help u
regards,
sindhu.
‎2008 Jun 13 4:25 AM
hi siva,
data : begin of itab occurs 0.
data : project like zmytable-project.
data : cnt type i.
data : end of itab.
Select project count(*) as cnt
from zmytable
into table itab
group by project
i think this will help u
regards,
sindhu.
‎2008 Jun 13 4:41 AM
Check this code, hope this helps
data:
count type i.
sort itab by orderid.
loop at itab.
count = count + 1.
at end of orderid.
if count = p_count
append itab to temp_itab.
endif.
clear count.
endat.
endloop.
‎2008 Jun 13 6:00 AM