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: 

file open error at ftp even the file is not open.....

Former Member
0 Kudos

Hi,

i get the error File open with the fm GUI_UPLOAD while uploading the XML file from FTP server.

What is interesting is that i did not open the file, furthermore i closed all the windows else that sap window,

but still i get the file open error.

We create the xml file when created a new delivery. And this xml file is sent to a bukrs's ftp and they also sent the same xml after some validations done.

When it arrives to our ftp server i make it post goods issue automatically but from yesterday i got the file open error, it was working fine just before today.

What could be the problem?

Hint: Yesterday and previous day files still work fine but files created today are faulty.

Thanks.

5 REPLIES 5

Former Member
0 Kudos

This might be a authorization problem. Please check if you have the following authorization:

Authorization object: S_GUI

Activity: 60

Former Member
0 Kudos

Hi,

GUI_UPLOAD is normally used to read data from front end - ie: from the PC.

In order to read data from the FTP server,

Proceed as below:

 DATA: d_filename like rlgrap-filename value '/usr/sap/tmp/test_filetxt' 
           
            OPEN DATASET d_filename FOR [specify whether for Input/Output] IN TEXT MODE
            IF SY-SUBRC NE 0. "Cannot Open File
                   [Raise Error Message ]
     
           ELSE.
               DO.
                      READ DATASET d_filename INTO wa_tab.
                     [Process the data]
              ENDDO.

        ENDIF.

Regards,

Shiny

0 Kudos

Thanks for replies.

My code is that:

call function 'HTTP_SCRAMBLE'
    EXPORTING
      source      = gv_password
      sourcelen   = slen
      key         = gv_key
    IMPORTING
      destination = gv_password.
  describe field gv_password length gv_pwd_len in character mode.

  call function 'FTP_CONNECT'
    exporting
      user            = 'HHH\GrupMMM'
      password        = gv_password
      host            = '10.10.10.10' "assume that is the host
      rfc_destination = 'SAPFTPA' 
    importing
      handle          = gv_handle
    exceptions
      not_connected   = 1
      others          = 2.
  if sy-subrc eq 0.
    "concatenate 'put' ld_full_path '[' ld_full_path ']'
    *gv_com = 'lcd C:\MMM\RETURN_FILES'.*
    clear mtab_data.
    free mtab_data.
    call function 'FTP_COMMAND'
      exporting
        handle        = gv_handle
        command       = gv_com
      tables
        data          = mtab_data
      exceptions
        tcpip_error   = 1
        command_error = 2
        data_error    = 3
        others        = 4.
    if sy-subrc eq 0.
    endif.

When i get the list of the return files i get data of each file via gui_upload.

CALL FUNCTION 'GUI_UPLOAD'
        EXPORTING
          filename   = filename
          filetype   = 'BIN'                              
        IMPORTING
          filelength = totalsize
        TABLES
          data_tab   = xml_table[]
        EXCEPTIONS
          FILE_READ_ERROR = 1
          FILE_OPEN_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.

However i get the open error for all files created today.

By the way, how can i use open dataset instead of ftp commands? How can i see the files at apllication server?

i get the files via IP of the FTP but how can i get files from application server?

Thanks.

0 Kudos

In that case, Are you able to view the files in your FTP server? Did you check the Access rights of the files? do they all have rwxrwxrwx access rights?

If not try to change the access rights (read-write-execution authorization) of the files.

You can use the unix command :

chmod 777 <filename>.<ext>

0 Kudos

And .. by the way , FYI, FILE_OPEN_ERROR is raised when it failed to open the file, it does not necessarily mean that the file is already opened.

It just ,means that the file cannot be opened for some reason