Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

About WS_UPLOAD

Former Member
0 Kudos
481

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.

11 REPLIES 11

Former Member
0 Kudos
208

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

0 Kudos
208

It is already existing program, I cant change that program.

It came for modification. This program is used in another program.

Former Member
0 Kudos
208

hi,

dont give file separator.

and the file name what you specify should end in .txt.

Former Member
0 Kudos
208

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.

0 Kudos
208

The funny thing is, sometime it accepts as space separated and some other time it accepts as tab delimited. I cant understand why...

former_member181995
Active Contributor
0 Kudos
208

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.

Former Member
0 Kudos
208

Hi,

Eventhough u have given ASC file type..

while downloading the file that time you can given extension type.

Regards,

venkat n

Former Member
0 Kudos
208

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

Former Member
0 Kudos
208

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

Former Member
0 Kudos
208

no comments

0 Kudos
208

If you don't want to add any comment you can leave that window BLANK also.