Application Development and Automation 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: 
Read only

Issue with FTP command while deleting a file.

Former Member
0 Likes
1,492

Hello All,

I am trying to delete a file from the FTP server after the file is processed. I am able to connect to the server, I am able to pick the .csv file and place the data in an internal table, and am able to process it as required in SAP. After the processing, I need to delete that file from the FTP server. I did not change the working directory and gv_filename is the variable which is holding the filename. I am using the following code


concatenate 'delete' gv_filename into lv_cmd separated by space.
  REFRESH mdata.
  CALL FUNCTION 'FTP_COMMAND'
    EXPORTING
      handle        = gv_handle
      command       = lv_cmd
    TABLES
      data          = mdata[]
    EXCEPTIONS
      tcpip_error   = 1
      command_error = 2
      data_error    = 3
      OTHERS        = 4.

When I check the mdata which returns the result of the command, I get the message 550: unable to delete <pat>\filename,

where as the file does exist. Is there any condition where in we may not be authorized to delete the file? If so is there any way to check that?

Thanks and Regards,

Sachin

4 REPLIES 4
Read only

Former Member
0 Likes
830

Hi Sachin Dargan,

Yes.. You need to get read and write access for the directory of FTP file server where it is located..

Ask to BASIS or Network admin to give your authorization for it..

Also using upper case in single quotes is better.. as sometimes it may cause problem..

concatenate 'DELETE' gv_filename into lv_cmd separated by space.

Hope it will solve your problem..

Thanks & Regards

ilesh 24x7

ilesh Nandaniya

Read only

0 Likes
830

Hello Ilesh,

Thanks for the quick response. Is there anyway we can check the attributes of the file. We are able to read the file as the data is coming into the internal table after using the function module FTP_SERVER_TO_R3. Is it still possble that there may be some sort of restriction on deleting a file but able to read the file on the server. Also I checked the path and it is pointing to a directory on the application server, where the file exits and the column Usable is set to X.

Thanks and Regards,

Sachin Dargan

Read only

0 Likes
830

Hi Sachin Dargan,

you can read the file if you have read access but if you want to delete the file then you need write access as well..

ask you admin or BASIS to provide you write access for the file and folder(directory)..

Hope it will solve your problem..

Thanks & Regards

ilesh 24x7

ilesh Nandaniya

Read only

Former Member
0 Likes
830

Thanks the issue has been resolved as it seems to be an authorization issue. Write access was not available at that time.