Skip to Content
0
Former Member
Jul 15, 2005 at 02:45 AM

Load flat file into a database table

806 Views

I have a database table ztab_sal that has the following fields

field-datatype-length-decimals

mandt-clnt-3-0

field1-numc-3-0

field2-numc-3-0

field3-numc-3-0

field4-quan-17-0

field5-dec-17-2

field6-dec-17-2

field7-dec-17-2

I am using UPLOAD_FILES function module to load a spreadsheet into ztab_sal. I have tried various things but it fails on me miserably. Following is the code I use..

parameters: name(128),

type(3).

data: fitab like RLGRAP occurs 0 with header line.

data: itab like ZTAB_SAL occurs 0 with header line.

fitab-FILENAME = name.

append fitab.

call function 'UPLOAD_FILES'

exporting I_TRUNCLEN = ' '

I_FILETYPE = type

I_XPC = 'X'

tables FILE_ALL = itab

TAB_FILE = fitab.

I take user input for filename and filetype. Say "load" is the name of the file then I have tried c:\load.xls and c:\load.csv filenames with every possible combination of filetype (ASC to DAT). Everytime the error is "Error Reading file". I tried to debug, it goes into GUI_UPLOAD function module well but somewhere it's missing something. Can anyone help me with this? Thanks for your inputs.

Sam