11-29-2007 6:28 PM
Hi All,
I am using GUI_UPLOAD as shown below to upload data from from front end using an excel file,
but i am getting some junk data into the internal table,please solve this and i need to use GUI_UPLOAD only.
DATA: I_TEMP_FILE TYPE STRING.
MOVE P_FILE TO I_TEMP_FILE.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
FILENAME = I_TEMP_FILE
FILETYPE = 'ASC'
HAS_FIELD_SEPARATOR = 'X'
TABLES
DATA_TAB = IT_MASTER
EXCEPTIONS
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.
IF SY-SUBRC = 0.
ENDIF.
Thanks,
Kumar
11-29-2007 6:44 PM
Make sure your internal table has same no.of.fields that you have in your file.
11-29-2007 6:45 PM
11-29-2007 7:30 PM
Kumar,
Check your Fields in flat file & fields in internal table are in the same order.
Regards,
Satish
11-29-2007 7:32 PM
Hi Kumar,
HAS_FIELD_SEPARATOR = 'X'
Please chek this condition. and check your flat file for the field seperator.
Thanks
Pavan
12-20-2007 5:30 PM
Hi Kumar,
Did you find a solution to this issue,
I am also facing the same problem, but my code uses the method GUI_UPLOAD and not the FM,
Would be great if you could let me know the solution,
Appreciate it
lalitha
12-20-2007 5:34 PM
as I know you save the xls into a tab delimited or comma seperated file and then try.. Once I had the same problem, this solved my issue.
12-20-2007 5:40 PM
begin of itab,
raw(255) type x,
end of itab occurs 0.
CALL FUNCTION 'GUI_UPLOAD'
exporting
filetype = 'BIN'
filename = 'C:\File.XLS'
tables
data_tab = itab.
Loop at itab.
SPLIT wa_data
AT cl_abap_char_utilities=>horizontal_tab
INTO
wa_data-field1
wa_data-field2
...................
wa_data-fieldn.
APPEND wa_data_create TO itab_data_create.
endloop.
Hope it helps.
Lokesh
Edited by: Lokesh Aggarwal on Dec 20, 2007 5:40 PM
12-26-2007 8:48 AM
As suggested, saving XLS files as tab delimted will solve the issue..
If you want to avoid it, use FM
ALSM_EXCEL_TO_INTERNAL_TABLE..
This will upload your Excel in from of Row number, column number and value...you can write a logic to loop at this table and transfer data in structured internal table in your program
12-26-2007 8:51 AM
Hi,
Use FM ALSM_EXCEL_TO_INTERNAL_TABLE instead of GUI_UPLOAD.
Regards,
Prashant