Skip to Content
author's profile photo Former Member
Former Member

Transfer file from SAP server to local file server


I have a requirement wherein we are required to send a file from the SAP server to a file server. I am able to use the "OPEN DATASET" command to move the contents of the table to the file to a specific location in the SAP server. Could anyone let me know as to how I can transfer the file to the file server?

I have tried the following

  • OPEN DATASET '\\<server>\folder\filename.txt' in TEXT MODE.....
    • This wrote the file to the DIR_SAPUSERS directory in the SAP server

  • Used the FTP_CONNECT. I have a username and password to a folder created in the file server. Opened the port 22. All permissions given at the OS level
    • This just returns sy-subrc as 1

  • Tried the FM C13Z_FRONT_END_TO_APPL
    • This does write correctly to the folder on SAP server. Changing the target like the one mentioned in the first method yeilds the same result as the first method.

I am keen on using the OPEN DATASET method rather than FTP. Could anyone let me know how I can do this and what are the prerequisites?I have tried searching for this requirement however not able to find any solutions.

Thanks and best regards,


Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Aug 01, 2012 at 12:20 PM


    The first thing is to know where the local server is:

    If it belongs to Application Server you can use OPEN DATASET command

    If it belongs to Presentation Server you can use fm GUI_DOWNLOAD

    If it belongs to a ftp server you can use ftp (see reports like RSFTP00x)

    It can use other solution but it needs to know more information about the local server


    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Hi Max,

      The more I look at it, the more FTP looks like the right (and probably the only) solution to my problem. Could you please help me a little more by providing some pre-requisites to the FTP solution?

      • The network team has setup a folder in a FTP server and provided me with a user name and password.
      • I am able to access the same using FTP from my windows system
      • I have the port 22 (SSH) open. Ports 20 and 21 are closed.
      • I am also getting successful test results when running the programs RSFTP007 and RSFTP009.

      However when running FTP_CONNECT, the sy-subrc returns as 1. I have scrambled the password before using FTP_CONNECT. Am I missing something?

      Thanks and regards,


  • Posted on Aug 01, 2012 at 08:08 PM

    At our company we have mapped file server locations to our application server, just like mapped drives in Windows (ours are unix, i'm not sure what the unix nomenclature is). This way we can read and write files to the file server using DATASET statements. Of course this is a job for BASIS, but it did make our lives easier.

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member


      Alex is right:

      If the local server or a its directory is shared in the same network of SAP server: it'll belong to Application Server too (It doesn't need this new is mapped for AL11).

      In this case you can OPEN DATASET.

      But this decision has to be discussed with your basis.

      For FTP: the report RSFTP00x can show you how to run the FTP

      If your report doesn't work you should post your code: remeber there are 2 FTP destination in order to run the ftp command from your pc or from SAP server.


  • author's profile photo Former Member
    Former Member
    Posted on Aug 02, 2012 at 03:58 PM

    Hi Prem

    Another method that I used was by creating an OS Level script to do the move and then you can execute it using sm69.



    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.