10-09-2007 9:35 AM
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?
10-09-2007 9:40 AM
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
10-09-2007 9:41 AM
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
10-09-2007 9:44 AM
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..
10-09-2007 10:08 AM
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