Application Development 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: 

selecting first few records

Former Member
0 Kudos

hi,

i want to select first few records and do the next process and the rest of the records with another process. how to select say first 5 records from an internal table.

Thanks in advance

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi Arun,

Check this code ,

DATA : begin of itab occurs 0 ,

a type char1,

b type i ,

end of itab ,

begin of jtab occurs 0 ,

a type char1,

b type i ,

end of jtab ,

  • Getting details

lin1 type i ,

lin2 type i ,

final type i .

itab-a = 'a' .

itab-b = '1' .

append itab .

itab-a = 'a' .

itab-b = '2' .

append itab .

itab-a = 'a' .

itab-b = '3' .

append itab .

itab-a = 'b' .

itab-b = '1' .

append itab .

jtab] = itab[ .

DESCRIBE TABLE ITAB lines lin1.

DELETE JTAB WHERE a = 'a' .

DESCRIBE TABLE JTAB lines lin2 .

  • Required Data

final = lin1 - lin2 .

write : 'number of records =' , final .

hope it helps...

or try this:

try like this :

itab_buff[ ] = itab[ ].

delete itab_buff where kunnr NE '10000'.

Data: lv_lines type i.

Describe table itab_buff lines lv_lines.

kindly reward if found helpful.

cheers,

Hema.

4 REPLIES 4

Former Member
0 Kudos

Hi Arun,

Check this code ,

DATA : begin of itab occurs 0 ,

a type char1,

b type i ,

end of itab ,

begin of jtab occurs 0 ,

a type char1,

b type i ,

end of jtab ,

  • Getting details

lin1 type i ,

lin2 type i ,

final type i .

itab-a = 'a' .

itab-b = '1' .

append itab .

itab-a = 'a' .

itab-b = '2' .

append itab .

itab-a = 'a' .

itab-b = '3' .

append itab .

itab-a = 'b' .

itab-b = '1' .

append itab .

jtab] = itab[ .

DESCRIBE TABLE ITAB lines lin1.

DELETE JTAB WHERE a = 'a' .

DESCRIBE TABLE JTAB lines lin2 .

  • Required Data

final = lin1 - lin2 .

write : 'number of records =' , final .

hope it helps...

or try this:

try like this :

itab_buff[ ] = itab[ ].

delete itab_buff where kunnr NE '10000'.

Data: lv_lines type i.

Describe table itab_buff lines lv_lines.

kindly reward if found helpful.

cheers,

Hema.

Former Member
0 Kudos

Hello,

Loop through the internal table and check sy-tabix > 5 and do the call to the process.

Thanks,

Venu

Former Member
0 Kudos

SELECT ... UP TO 5 ROWS.

Press F1 on SELECT.

Rob

Former Member
0 Kudos

hi

good

you can use SELECT UPTO 5 ROWS.

THANKS

mrutyun^