Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Upload of excel sheet into internal table

How can we upload a singe Excel file with abap program.

i had used GUI_UPLOAD.

The code which i m using is given below,but it is not giving the proper output.

The excel sheet has 6 columns and around 3000 rows to upload.

can any one correct my code.


types: begin of tdat,

fld1(20) type c,

fld2(20) type c,

fld3(10) type c,

fld4(10) type c,

fld5 type d,

fld6 type i,

end of tdat.

data: idat type standard table of tdat initial size 0,

wa_dat type tdat.

data: file_str type string.

parameters: p_file type localfile.

at selection-screen on value-request for p_file.

call function 'KD_GET_FILENAME_ON_F4'


static = 'X'


file_name = p_file.


file_str = p_file.

call function 'GUI_UPLOAD'


filename = file_str

has_field_separator = 'X'


data_tab = idat


file_open_error = 1

file_read_error = 2

no_batch = 3

gui_refuse_filetransfer = 4

invalid_type = 5

no_authority = 6

unknown_error = 7

bad_data_format = 8

header_not_allowed = 9

separator_not_allowed = 10

header_too_long = 11

unknown_dp_error = 12

access_denied = 13

dp_out_of_memory = 14

disk_full = 15

dp_timeout = 16

others = 17.

loop at idat into wa_dat.

write :/ wa_dat-fld1.


Former Member

Helpful Answer

Not what you were looking for? View more on this topic or Ask a question