2009 Mar 17 10:29 AM
Hi Experts,
I am transferring excel sheet content to internal table, for which I am using GUI_UPLOAD function module. It is successfully reading, but I am getting ##### values instead of text values. I am getting more than expected lines also. My code is below.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = w_file_url
FILETYPE = 'DAT'
HAS_FIELD_SEPARATOR = 'X'
tables
data_tab = t_uploadeddata
I used my file type as 'ASC' and 'BIN' also. Can anybody help me?
Thanks and regards,
Venkat
2009 Mar 17 10:49 AM
hi,
try out the following function module...
CALL FUNCTION 'TEXT_CONVERT_XLS_TO_SAP'
EXPORTING
* I_FIELD_SEPERATOR =
* I_LINE_HEADER = 'X'
i_tab_raw_data = it_type
i_filename = p_file
TABLES
i_tab_converted_data = t_upload[]
EXCEPTIONS
conversion_failed = 1
OTHERS = 2.Thanks
Sharath
hi,
try out the following function module...
CALL FUNCTION 'TEXT_CONVERT_XLS_TO_SAP'
EXPORTING
* I_FIELD_SEPERATOR =
* I_LINE_HEADER = 'X'
i_tab_raw_data = it_type
i_filename = p_file
TABLES
i_tab_converted_data = t_upload[]
EXCEPTIONS
conversion_failed = 1
OTHERS = 2.Thanks
Sharath
2009 Mar 17 10:38 AM
the function module gui_upload, accepts the filename as a string variable....
hence do the following
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-T01.
PARAMETERS : P_FILE TYPE RLGRAP-FILENAME DEFAULT 'D:\Example.txt'.
SELECTION-SCREEN END OF BLOCK B1.
data : w_file type string.
w_file = p_file.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = W_FILE
FILETYPE = 'ASC'
has_field_separator = ' '
tables
data_tab = FILE_ITAB
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.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
2009 Mar 17 10:49 AM
hi,
try out the following function module...
CALL FUNCTION 'TEXT_CONVERT_XLS_TO_SAP'
EXPORTING
* I_FIELD_SEPERATOR =
* I_LINE_HEADER = 'X'
i_tab_raw_data = it_type
i_filename = p_file
TABLES
i_tab_converted_data = t_upload[]
EXCEPTIONS
conversion_failed = 1
OTHERS = 2.Thanks
Sharath
2009 Mar 17 11:20 AM
Hi,
Better use 'TEXT_CONVERT_XLS_TO_SAP' or KCD_EXCEL_OLE_TO_INT_CONVERT or ALSM_EXCEL_TO_INTERNAL_TABLE instead of GUI_UPLOAD.
Definetly your problem will be solved.
PS: serach the FM name on the forum or on the net for the code snippet ,you get plenty of them
Pooja
Edited by: Pooja Gupta on Mar 17, 2009 12:21 PM
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |