‎2006 Nov 22 2:38 AM
Hi,
I Created a customised table and i have to upload more than one million records in to the customised table.
So pls suggist me how to do and which method we have to use, if you have any sample prog for that pls give me that.and pls explain me in detail so that i can sove the issue.
Thanks,
Regards,
Rajendra.
‎2006 Nov 22 2:42 AM
Hi,
If you have the data in a file..
report ztest.
data: itab type table of string with header line.
data: xztable type ztable.
call function 'GUI_UPLOAD'
exporting
filename = 'c:\ztable.txt'
tables
data_tab = itab.
loop at itab.
move itab to xztable.
insert ztable from xztable.
endloop.
Thanks,
Naren
‎2006 Nov 22 2:42 AM
Hi,
If you have the data in a file..
report ztest.
data: itab type table of string with header line.
data: xztable type ztable.
call function 'GUI_UPLOAD'
exporting
filename = 'c:\ztable.txt'
tables
data_tab = itab.
loop at itab.
move itab to xztable.
insert ztable from xztable.
endloop.
Thanks,
Naren
‎2006 Nov 22 2:58 AM
Another approach of Naren's Code. Hope Naren wouldnt mind...:)
report ztest.
data: itab type table of string with header line.
data: xztable type ztable.
call function 'GUI_UPLOAD'
exporting
filename = 'c:\ztable.txt'
tables
data_tab = itab.
<b>*loop at itab.
*move itab to xztable.
*insert ztable from xztable.
*endloop.
insert ztable from table itab.</b>
Note above works as long as the structure of itab(data in file) is same as ZTABLE.
Kind Regards
Eswar
‎2006 Nov 22 3:01 AM
‎2006 Nov 22 4:05 AM
Write a temporary program to upload these many records.
sample report:-
data : g_t_excel_data like alsmex_tabline occurs 0 with header line,
ITAB like your table structure,
g_index like sy-tabix.
parameters: p_pcfile type localfile,
field-symbols : <fs>.
start-of-selection.
*Function to get the excel data from the file into internal table
call function 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
filename = p_pcfile
i_begin_col = 1
i_begin_row = 2
i_end_col = 2
i_end_row = 65536
TABLES
intern = g_t_excel_data
EXCEPTIONS
inconsistent_parameters = 1
upload_ole = 2
others = 3.
if sy-subrc <> 0.
message 'Error opening specified file' type 'E'.
endif.
loop at g_t_excel_data.
move : g_t_excel_data-col to g_index.
assign component g_index of structure ITAB to <fs>.
move : g_t_excel_data-value to <fs>.
*at end of row append record
at end of row.
append ITAB..
clear ITAB.
clear <fs>.
endat.
endloop.
*update database table
loop at ITAB.
insert "TABLE NAME" from ITAB. "insert into table
endloop.
‎2006 Nov 22 4:14 AM
An important consideration is that the rollback segment is not infinitely large. Therefore, you will have to do database commits every so often in order to avoid a dump based on not being able to extend it.
rob