2008 Aug 01 11:03 AM
Hi All,
I am using a program in which the function module ws_upload is used. The excel file has to be converted to txt file and should be sent as input through this function module. File type is used as 'ASC' in this function module. How can I save the excel to txt? If I am giving Tab separated file, it is giving error that invalid file type. If saved as space delimited file, it is giving error as file read error, how to save the file?
Thanks in advance.
Regards,
Suresh.
2008 Aug 01 11:08 AM
Suresh,
Please check that you are providing correct filename & Directory into FM call. Also WS_UPLOAD FM is obsolete. Try using GUI_UPLOAD FM.
Thanks & Regards,
Mahesh Apte
2008 Aug 01 11:13 AM
It is already existing program, I cant change that program.
It came for modification. This program is used in another program.
2008 Aug 01 11:09 AM
hi,
dont give file separator.
and the file name what you specify should end in .txt.
2008 Aug 01 11:12 AM
No, There is no restriction on file extension as to be .txt only. It can be anything. It is important that data into the file is in correct format.
Try using file in notepad and review content. I strongly feel that filename providing in FM call in incorrect.
2008 Aug 01 11:14 AM
The funny thing is, sometime it accepts as space separated and some other time it accepts as tab delimited. I cant understand why...
2008 Aug 01 11:14 AM
Suresh,
first you need to upload excel into one internal table by using
CALL FUNCTION 'TEXT_CONVERT_XLS_TO_SAP'
EXPORTING
* I_FIELD_SEPERATOR =
i_line_header = 'X'
i_tab_raw_data = it_raw
i_filename = pfile
TABLES
i_tab_converted_data = it_excel[]
* EXCEPTIONS
* CONVERSION_FAILED = 1
* OTHERS = 2
.
than from itab you can again download it to text format by using gui_download.
just refer for download itab into text file:
Amit.
2008 Aug 01 11:17 AM
Hi,
Eventhough u have given ASC file type..
while downloading the file that time you can given extension type.
Regards,
venkat n
2008 Aug 01 11:19 AM
Hi,
In that excel file, the file type is text(Tab delimited) file
make sure that u have to delete the heading line before you save as a text file
In function module for field separator field u give like this
has_field_separator = 'X'
I hope it will help you.
Thanks & Regards,
John Victor
2008 Aug 01 11:28 AM
This is the function module which has been used in the program. It has not CTS number so can't change the code. This program calls a user exit which I have to change.
Please suggest.
It is giving either file open error or invalid file type error.
CALL FUNCTION 'WS_UPLOAD'
EXPORTING
CODEPAGE = ' '
FILENAME = DSN
FILETYPE = 'ASC'
LINE_EXIT = ' '
TRUNCLEN = ' '
USER_FORM = 'READ_DATASET'
USER_PROG = 'RKTEST08'
TABLES DATA_TAB = INT_RECORD
EXCEPTIONS
CONVERSION_ERROR = 01
FILE_OPEN_ERROR = 02
FILE_READ_ERROR = 03
INVALID_TABLE_WIDTH = 04
INVALID_TYPE = 05
NO_BATCH = 06
UNKNOWN_ERROR = 07.
IF SY-SUBRC NE 0.
MESSAGE E001 WITH 'Unable to download file.' 'Return code:'
SYST-SUBRC.
ENDIF.
Edited by: SURESH KUMAR on Aug 1, 2008 3:59 PM
2009 Mar 23 1:43 PM
2009 Mar 23 1:44 PM
If you don't want to add any comment you can leave that window BLANK also.