Downloading files to PC(Presentation Server)

There are also a number of other function modules which could be used for uploading/downloding files between SAP and the presentation server.

*   Download internal table to presentation server file(PC)
  DATA: ld_filename TYPE string,
* Pre version 4.7 declaration e_file like rlgrap-filename.
  DATA: begin of it_datatab occurs 0,
  row(500) type c,
 end of it_datatab.
  call function 'GUI_DOWNLOAD'
       exporting
            filename         = ld_filename
            filetype         = 'ASC'
       tables
            data_tab         = it_datatab[]
       exceptions
            file_open_error  = 1
            file_write_error = 2
            others           = 3.

*   Download internal table to presentation server file(PC)
*   Separating fields/columns by a tab
  DATA: ld_filename TYPE string,
* Pre version 4.7 declaration e_file like rlgrap-filename.
  DATA: begin of it_datatab occurs 0,
  col1(50) type c,
  col2(50) type c,
  col3(50) type c,
*       etc....
 end of it_datatab.
  CALL FUNCTION 'GUI_DOWNLOAD'
   EXPORTING
        filename         = ld_filename
        filetype         = 'ASC'
*       APPEND           = 'X'
        write_field_separator = 'X'
*       CONFIRM_OVERWRITE = 'X'
   TABLES
        data_tab         = it_datatab[]
   EXCEPTIONS
        file_open_error  = 1
        file_write_error = 2
        OTHERS           = 3.

Related Articles

SAP applications and ABAP reports that process data files stored on your PC or within SAP
HEX codes and there associated ABAP declaration within SAP
Display files on SAP Application Server(UNIX)
Browse files on SAP Application Server(UNIX)
Downloading files to SAP Application Server
Popup window to select a File using function module WS_FILENAME_GET
Get list of files within specific directory or SAP Application server
Directory selection for ABAP report using SAP method DIRECTORY_BROWSE
File Selection for ABAP report using SAP object method FILE_OPEN_DIALOG
Save file location popup on ABAP report selection screen using FILE_SAVE_DIALOG
ABAP Upload and download Function Modules in SAP
SAP File Selection Window - various methods of adding a file selection popup to your ABAP report
Upload Tab delimited file from PC into ABAP internal table
Upload and download files into and out of SAP or your PC
ABAP to check if file exists before downloading from SAP
SAP Upload Excel document into internal table
ABAP to Upload Excel document into internal table on SAP system including .xlsx
Upload Excel document into ABAP internal table
ABAP Uploading files from PC to SAP R/3 system
ABAP to Upload files from SAP Application Server
Upload Tab delimited file from PC into ABAP internal table
Upload Tab delimited file from application server into ABAP internal table
Example Excel Spreadsheet used to demo SAP upload and download using ABAP
Download file from SAP unix system to your desktop using transaction SXDA