‎2007 Feb 15 11:08 AM
Hi all
Please solve this problem.I am writing this code in my program to get the data from Excel or Tab delimited file.But i am getting the exception as BAD DATA FORMAT.
call function 'GUI_UPLOAD'
exporting
filename = 'c:\temp\websure.xls'
FILETYPE = 'DAT'
HAS_FIELD_SEPARATOR = 'X'
HEADER_LENGTH = 0
READ_BY_LINE = 'X'
DAT_MODE = ' '
CODEPAGE = ' '
IGNORE_CERR = ABAP_TRUE
REPLACEMENT = '#'
CHECK_BOM = ' '
VIRUS_SCAN_PROFILE =
NO_AUTH_CHECK = ' '
IMPORTING
FILELENGTH = lv_filelength
HEADER =
tables
data_tab = lt_zobj_insp
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.
WRITE 'Error occured while transfering data from input file.'.
ENDIF.
Thank you.
Regards
Giri.
‎2007 Feb 15 11:13 AM
see excel has different format .
its not in the same format as txt file
the data is stored in
R X C
rows by columns style .
u need to use Fm <b>ALSM_EXCEL_TO_INTERNAL_TABLE</b> to fetch the data.
regards,
vijay
‎2007 Feb 15 11:14 AM
Uncomment the filetype parameters. Also save your file as a tab delemited file. This will give it a .txt extension.
‎2007 Feb 15 11:38 AM
you have to uncomment file_type = 'DAT' and i think file name should be given in CAPITAL letters.
regards
shiba dutta