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

Without select upto

former_member233090
Active Contributor
0 Likes
323

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

1 ACCEPTED SOLUTION
Read only

deepak_dhamat
Active Contributor
0 Likes
297

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.

1 REPLY 1
Read only

deepak_dhamat
Active Contributor
0 Likes
298

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.