Skip to Content
author's profile photo
Former Member

WS_DOWNLOAD in background?

Hey guys, I have a question for you. I'm looking to do some sort of a download that executes in the background and stores the file onto a networked drive. I don't think WS_DOWNLOAD works because once you start in the background you loose access to the download destination (or something to that effect).

Anyways, was wondering if there was a way to use ws_download or another equivalent program to execute this the background. Thanks a lot.

-Shaunt

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

5 Answers

  • author's profile photo
    Former Member
    Posted on Aug 31, 2004 at 05:23 AM

    Hi,

    You can download data on an application ( not presentation ) server in background using dataset : first "open dataset ... " then "transfer ... " and at the end "close dataset ... ".

    Regards,

    Małgorzata

    Add comment
    10|10000 characters needed characters exceeded

  • Posted on Aug 31, 2004 at 05:24 AM

    Hi,

    Did you try OPEN DATASET.

    regards,

    Prabhu Rajesh.

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      > Hi,

      >

      > you can use the open dataset for downloading files

      > where ever you want. With the open dataset statement

      > you can save files in the sap directory of the

      > application server. So just add an sap directory at

      > the application server which is mapped at your

      > presentation server or a file server or what ever.

      > The destination has to be mapped on your application

      > server. So if you use open dataset with the added sap

      > directory the system will save your file at the

      > directory you want.

      >

      > hope that helps

      > Chris

      Hi

      What exactly do you mean by "the destination has to be mapped on your application server"?

      Do you mean, like, create a mapped network drive IN WINDOWS to the destination you want? Or are you referring to some mapping in SAP itself?

      And also, which user is used when SAP sends/writes the file to the destination folder?

      Does it match with your SAP service?

  • author's profile photo
    Former Member
    Posted on Aug 31, 2004 at 08:12 AM

    Hi,

    DOWNLOAD function does not work in the background as that it will be able to access the Presentation server. What you can do is send mail to the id and then download that from that id as mail can be send in the background.

    The FM used for sending mail is SO_NEW_DOCUMENT_ATT_SEND_API1

    Regards,

    Amit

    Add comment
    10|10000 characters needed characters exceeded

  • author's profile photo
    Former Member
    Posted on Dec 09, 2004 at 06:20 PM

    Couple of options:

    1> Use Samba with Unix Share

    2> Use sapftp, first write to UNIX and then use FTP_COPY to move file from UNIX to NT, better error handling

    3> Install SAP app instance on NT server and make it as Background server. Run all jobs on this instance and use open dataset option and files will be created directly NT server

    Add comment
    10|10000 characters needed characters exceeded

  • Posted on Dec 10, 2004 at 08:48 PM

    In situations like this, we normally take the help of the networking people and have the Windows directory mounted onto the SAP application server. That way you can download it to an application server directory in the background and yet see it in your desktop directory at the same time.

    Let me know if this helps.

    Srinivas

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Actually you can do a direct FTP to Windows box if you have FTP service running on it (on Windows 2000, it comes default with IIS, just need to turn it on). In SAP use the following FM after initializing the connection. It will transfer the table directly to the file. Make sure $table has rows of type C or string and size enough to take care of your largest record.

      <b>

      CALL FUNCTION 'FTP_R3_TO_SERVER'

      EXPORTING

      handle = v_handle

      fname = v_filename

      character_mode = 'X'

      TABLES

      text = $table

      EXCEPTIONS

      tcpip_error = 1

      command_error = 2

      data_error = 3

      OTHERS = 4.

      </b>

      And the following for the other way around:

      <b>

      CALL FUNCTION 'FTP_SERVER_TO_R3'

      EXPORTING

      handle = v_handle

      fname = v_filename

      character_mode = 'X'

      IMPORTING

      blob_length = $size

      TABLES

      text = $table

      EXCEPTIONS

      tcpip_error = 1

      command_error = 2

      data_error = 3

      OTHERS = 4.

      </b>

      Actually we have a class wrapped around this call, we use here quite often. The destination directory is shared on desktops of end-users.