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 using 'GUI_UPLOAD'

Former Member
0 Likes
733

Hi all,

l like to upload data from local file.

My question is how to upload data from .xls file using function 'GUI_UPLOAD', and then transfert that data into local internal table.

Bob

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
700

Hello,

You can get filetype by extracting last three characters of filename. It can be .xls,.txt,etc..

If it is of '.txt',use Function module 'GUI_UPLOAD'.

If it is of '.xls',use Function module 'ALSM_EXCEL_TO_INTERNAL_TABLE'.

Regards,

Deepu.K

6 REPLIES 6
Read only

Former Member
0 Likes
701

Hello,

You can get filetype by extracting last three characters of filename. It can be .xls,.txt,etc..

If it is of '.txt',use Function module 'GUI_UPLOAD'.

If it is of '.xls',use Function module 'ALSM_EXCEL_TO_INTERNAL_TABLE'.

Regards,

Deepu.K

Read only

suresh_datti
Active Contributor
0 Likes
700

Have you tried using the function call ALSM_EXCEL_TO_INTERNAL_TABLE ?

~Suresh

Read only

Former Member
0 Likes
700

Hi,

If u want to upload from Excel then use this FM "'ALSM_EXCEL_TO_INTERNAL_TABLE'"

Hope this info helps.

Regards,

Kumar.

Read only

Former Member
0 Likes
700

hI,

To Upload the excel file FM 'ALSM_EXCEL_TO_INTERNAL_TABLE'

BElow is the sample code.

report ztest.

types: begin of ttab ,

fld1(30) type c,

fld2(30) type c,

fld3(30) type c,

fld4(30) type c,

fld5(30) type c,

end of ttab.

data: itab type table of ttab with header line.

selection-screen skip 1.

parameters: p_file type localfile default

'C:\test.txt'.

selection-screen skip 1.

at selection-screen on value-request for p_file.

call function 'KD_GET_FILENAME_ON_F4'

exporting

static = 'X'

changing

file_name = p_file.

start-of-selection.

clear itab. refresh itab.

perform upload_data.

loop at itab.

write:/ itab-fld1, itab-fld2, itab-fld3, itab-fld4, itab-fld5.

endloop.

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

  • Upload_Data

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

form upload_data.

data: file type rlgrap-filename.

data: xcel type table of alsmex_tabline with header line.

file = p_file.

call function 'ALSM_EXCEL_TO_INTERNAL_TABLE'

exporting

filename = file

i_begin_col = '1'

i_begin_row = '1'

i_end_col = '200'

i_end_row = '10000'

tables

intern = xcel

exceptions

inconsistent_parameters = 1

upload_ole = 2

others = 3.

loop at xcel.

case xcel-col.

when '0001'.

itab-fld1 = xcel-value.

when '0002'.

itab-fld2 = xcel-value.

when '0003'.

itab-fld3 = xcel-value.

when '0004'.

itab-fld4 = xcel-value.

when '0005'.

itab-fld5 = xcel-value.

endcase.

at end of row.

append itab.

clear itab.

endat.

endloop.

endform.

Reward Points if it is Useful.

Thanks,

Manjunath MS

Read only

Former Member
0 Likes
700

Hi,

Please use ws_upload instead.

See the following link for additional details:

http://goldenink.com/abap/ws_upload.html

Reward if helpful!

- John

Read only

Former Member
0 Likes
700

use FM

<b>ALSM_EXCEL_TO_INTERNAL_TABLE</b>