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: 

GUI_UPLOAD vs. WS_UPLOAD

Clemenss
Active Contributor
0 Kudos

Hi,

sorry to bore you with this one:

I used METHOD cl_gui_frontend_services=>GUI_UPLOAD to get the contents of an ASCII file into an internal table with records of structure Text1000, (default) FILETYPE = 'ASC'.

My ASCII file was not fully loaded, only line 1 of my internal table got populated, LF not recognized.

I tried WS_UPLOAD with filetype = 'ASC' and got as many records as I really have in File.

I suppose it is something about the line-breaks in the file. It is exported from Navision Axapta and transported via ftp.

Still I don't know why the 'recommended' new method 'GUI_UPLOAD' does not work at all.

Any suggestions?

C.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi,

Check whether u have passed the parameters correctly

Uploading files from PC(Presentation Server)

There are also a number of other function modules which could be used for uploading/downloding files

between SAP and the presentation server.


*   Retrieve data file from presentation server(Upload from PC)
DATA: i_file like rlgrap-filename value '/usr/sap/tmp/file.txt'.  
DATA: begin of it_datatab occurs 0,
  row(500) type c,
 end of it_datatab.

  CALL FUNCTION 'GUI_UPLOAD'
       EXPORTING
            filename        = i_file
            filetype        = 'ASC'
       TABLES
            data_tab        = it_datatab  "ITBL_IN_RECORD[]
       EXCEPTIONS
            file_open_error = 1
            OTHERS          = 2.

http://www.sapdevelopment.co.uk/file/file_uptabpc.htm

5 REPLIES 5

Former Member
0 Kudos

Hi,

Check whether u have passed the parameters correctly

Uploading files from PC(Presentation Server)

There are also a number of other function modules which could be used for uploading/downloding files

between SAP and the presentation server.


*   Retrieve data file from presentation server(Upload from PC)
DATA: i_file like rlgrap-filename value '/usr/sap/tmp/file.txt'.  
DATA: begin of it_datatab occurs 0,
  row(500) type c,
 end of it_datatab.

  CALL FUNCTION 'GUI_UPLOAD'
       EXPORTING
            filename        = i_file
            filetype        = 'ASC'
       TABLES
            data_tab        = it_datatab  "ITBL_IN_RECORD[]
       EXCEPTIONS
            file_open_error = 1
            OTHERS          = 2.

http://www.sapdevelopment.co.uk/file/file_uptabpc.htm

Former Member
0 Kudos

Difference method 'GUI_UPLOAD' and function 'GUI_UPLOAD' is importing parameter.

Function's importing parameter has 'READ_BY_LINE', and default value is 'X'.

But 'READ_BY_LINE' is not parameter of method.

I think Function 'GUI_UPLOAD' default value not effected.

Please, Try Debug...

Thanks.

Former Member
0 Kudos

cross check your code

data: wa_file type string.

data: tab_file like table of wa_file,

pcount type i.

field-symbols <tab> type standard table.

CALL METHOD CL_GUI_FRONTEND_SERVICES=>DIRECTORY_LIST_FILES

exporting

DIRECTORY = 'C:\test'

FILTER = '.'

FILES_ONLY = 'X'

  • DIRECTORIES_ONLY

changing

FILE_TABLE = tab_file

count = pcount.

ASSIGN ('internal_table') TO <tab>.

loop at tab_file into wa_file.

CALL METHOD CL_GUI_FRONTEND_SERVICES=>GUI_UPLOAD

exporting

FILENAME = wa_file

changing

data_tab = <tab>.

endloop.

regards

0 Kudos

... I thinks that was another thread...

Clemenss
Active Contributor
0 Kudos

be careful with those functions.