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

Internal table

Former Member
0 Likes
717

Hi,

I have 10 records in internal table, first 5 records is for one vendor and remaining 5 records for another vendor.

1. How can i store first 5 records in one internal table?

2. How can i store records from 6-10 in another internal table?

6 REPLIES 6
Read only

Former Member
0 Likes
686

Hi Udaya,

loop at itab.

if itab-vendor = 'A'.

append itab1

else

append itab2.

endif.

clear: itab,

endloop.

Reward if useful!

Read only

Former Member
0 Likes
686

Hi,

SORT ITAB by LIFNR.

LOOP AT ITAB.
 AT NEW LIFNR.
 MOVE ITAB to ITAB1.
 ENDAT.

MOVE ITAB to ITAB2.  " This will work from 6 to 10 records

ENDLOOP.

Regards

Sudheer

Read only

Former Member
0 Likes
686

Hi,

loop at itab.

If itab-vendor = 'B'.

append itab1.

elseif itab-vendor = 'D'.

append itab2.

endif.

endloop.

Regrads,

Priyanka.

Read only

Former Member
0 Likes
686

loop at itab.

if sy-tabix le 5.

move itab data to itab1.

append itab1.

else.

move itab data to itab2.

append itab2.

endif.

endloop.

Reward points if useful,

Aleem.

Read only

Former Member
0 Likes
686

data: itab1 type standrad table of mara,

itab2 type standrad table of mara,

itab3 type standrad table of mara,

itab4 type standrad table of mara,

itab5 type standrad table of mara,

itab6 type standrad table of mara,

itab7 type standrad table of mara,

itab8 type standrad table of mara.

data: variable type n.

l_table type string.

field-symbol: <fs_any> type table of any.

loop at itab.

on change of vendor_num.

variable = variable + 1.

concatenate itab variable into l_table.

assign (l_table) to <fs_any>.

<fs_any> = itab.

append <fs_any> .

endon.

endloop.

i think this will dynamically move the contents to different internal tables.

however you need to define those internal table in type statement.

just try it...hope it works.

Reward points if helpful

Read only

Former Member
0 Likes
686

Hi this question is answered