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

upload data to customised table

Former Member
0 Likes
599

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.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
569

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

5 REPLIES 5
Read only

Former Member
0 Likes
570

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

Read only

0 Likes
569

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

Read only

0 Likes
569

I think it is better to use a comma delimited file for data uploads, then you know exactly the columns in the data. So if you have a comma delimited file, you can upload it to your ztable like so.

Regards,

Rich Heilman

Read only

Former Member
0 Likes
569

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.

Read only

Former Member
0 Likes
569

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