Skip to Content
The Function modules GUI_DOWNLOAD/WS_DOWNLOAD are used to download the data into presentation server.But these function modules fail while the program is run in background.With the help of Open Dataset concept we can download file in background, but it downloads data into application server. One workaround is to download data into application server in background and read data from this application server file and download into presentation server. But this can’t be done at one go.  We need a way by which application server can recognize the presentation server file path at runtime. So that with the help of Open Dataset we can download data directly into the presentation server.  On the application server we can map network drive of the presentation server.  Go To My Computer->Tools->Map Network Drive image Provide shared folder path image Now with traditional dataset method we can download file into a presentation server.  parameters: resfile type string  default ‘\\serverhostname\foldername\file.txt’ .”Same as you specified in the map network drive folder  *Convert internal table to a string table CALL FUNCTION ‘ZCOV_TAB_STRING’   EXPORTING     DATA_TAB = itab   TABLES     STR_TAB  = str_tab.  open dataset  resfile for output in text mode encoding default. if sy-subrc = 0.   loop at str_tab.      transfer str_tab to resfile.   endloop.   if sy-subrc = 0.    write: ‘Successfully downloaded !’.   endif. endif. close dataset resfile.
To report this post you need to login first.

8 Comments

You must be Logged on to comment or reply to a post.

  1. Dushyant Shetty
    Since this approach works well for a single presentation server, there would be a “manual effort” overhead for triggering the background job from multiple users/PCs. How many folders will we share/map if more than one user needs this report.
    Wouldn’t it just be easier to do this?
    Say we use the DATASET method to export data into a shared folder on the Application server itself.
    Then use Folder Redirection through Windows Group Policy(a simple one-time administrative task) so that every user on the network will be able to see a “My SAP Documents” folder in their personal folders, whichever PC they logon to, but when they open the folder, it actually opens “\\appserver\downloadfolder\”.
    Then, we wouldn’t have to hard-code the logic or map different folders each time… all we have to do after the folder redirection has been maintained for all users is in the ABAP program, check for whether the value of sy-batch is ‘X’, and if it is, instead of using DOWNLOAD, use dataset method.

    Just a thought, this is generally what I suggest. It makes the Windows team work just a little harder, but my ABAP team and users live happily ever after 🙂

    Regards,

    Dushyant

    (0) 
  2. Peter Inotai
    Hi Monalisa,
    It’s one approach, however probable not the best.
    Mapping on UNIX or linux is not that obvious, so this approach would only work if you have Windows based application server.
    I don’t think any Basis admin would love the idea to create share folders in the application server for security and other reasons.
    Generating the file in the applcation server and downloading it to PC would be a better option. Or set up an FTP server which would copy files from the application server to a shared folder of the FTP server.
    Best regards,
    Peter
    (0) 
  3. srikanth vadlamani
    Gud work still we can do this using these fm’s

      CALL METHOD cl_gui_frontend_services=>file_save_dialog

      CALL FUNCTION ‘GUI_DOWNLOAD’

    and..
      CALL FUNCTION ‘DOWNLOAD’

    (0) 

Leave a Reply