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: 

insert 'n' records in internal table and then again n records

Former Member
0 Kudos

Hi,

I have a 1 lakh records. i want to insert first 5000 records into internal table <itab> and then transfer that records into database table<ztable> and then again 5000 records into same internal table<itab> and then to databse table<ztable>....

How to do it?

4 REPLIES 4

Former Member
0 Kudos

Hi

You separate the records into another internal table from the first one and use

declare ITAB1 and ITAB2 with same fields and write

loop at itab1.

if sy-tabix < 1000.

move-corresponding itab1 to itab2.

append itab2.

endif.

clear itab2.

endloop.

now use itab1 and then itab2.

***********************

REFRESH my_table2.

APPEND LINES OF my_table FROM 1 TO 5000 TO my_table2.

Now insert reocrds into database table.....n proceed similarly...

REFRESH my_table2.

APPEND LINES OF my_table FROM 5000 TO my_table2.

*************************

constants c_split type i value '5000'

loop at itab1.

move itab1 to itab2.

append itab2.

l_rem = sytabix mod c_split.

if l_rem EQ 0.

<< do what ever u want here using itab2.>>

refresh itab2.

clear itab2.

endif.

************

Regards

vasu

Former Member
0 Kudos

hi

try it like this.

data flag type i value '1'.

loop at <itab>.

if flag = 1.

insert <ztble> from <itab>.

endif.

if sy-tabix > 5000.

flag = 2.

insert <ztble> from <itab>.

endif.

endloop.

regards

baskaran

Message was edited by:

baskaran nagamanickam

abdulazeez12
Active Contributor
0 Kudos

all 1 lac records in jtab..

Append lines of jtab from 1 to 5000 to itab.

insert into <DBTAB> lines of itab.

commit work.

repeat the above till the total 1 lac records get updated..use a counter..

Former Member
0 Kudos

no actually while inserting in internal table it gives memory error. Here i have given 1 lakh as an example...actual entries are lot more...and internal table can't take that much load.....

so give another solution