Skip to end of metadata
Go to start of metadata

'WS_DOWNLOAD'   Function module is obsolete in ECC6, so we have to use Function Module 'GUI_DOWNLOAD' 

* to download the internal table data into excel format

* downloading a file for example pdf file to presentation server we use FM 'GUI_DOWNLOAD' 

*    CALL FUNCTION 'WS_DOWNLOAD'   
*      EXPORTING
*        CODEPAGE            = 'IBM'
*        FILENAME            = FILE
*        FILETYPE            = 'ASC'
*      TABLES
*        DATA_TAB            = DATA_TAB
*      EXCEPTIONS
*        FILE_OPEN_ERROR     = 1
*        FILE_WRITE_ERROR    = 2
*        INVALID_FILESIZE    = 3
*        INVALID_TABLE_WIDTH = 4
*        INVALID_TYPE        = 5
*        NO_BATCH            = 6
*        UNKNOWN_ERROR       = 7.

*DATA DECLARATION for GUI_DOWNLOAD.
 DATA : lv_filename type STRING.
lv_filename = file.
CONSTANTS: LV_FILETYPE TYPE CHAR10 VALUE 'ASC'.
 CALL FUNCTION 'GUI_DOWNLOAD'
  EXPORTING
    FILENAME                        = lv_filename
    FILETYPE                        = 'ASC'
    CODEPAGE                        = 'IBM'
  TABLES
    DATA_TAB                        = DATA_TAB
  EXCEPTIONS
    FILE_WRITE_ERROR                = 1
    NO_BATCH                        = 2
    GUI_REFUSE_FILETRANSFER         = 3
    INVALID_TYPE                    = 4
    NO_AUTHORITY                    = 5
    UNKNOWN_ERROR                   = 6
    HEADER_NOT_ALLOWED              = 7
    SEPARATOR_NOT_ALLOWED           = 8
    FILESIZE_NOT_ALLOWED            = 9
    HEADER_TOO_LONG                 = 10
    DP_ERROR_CREATE                 = 11
    DP_ERROR_SEND                   = 12
    DP_ERROR_WRITE                  = 13
    UNKNOWN_DP_ERROR                = 14
    ACCESS_DENIED                   = 15
    DP_OUT_OF_MEMORY                = 16
    DISK_FULL                       = 17
    DP_TIMEOUT                      = 18
    FILE_NOT_FOUND                  = 19
    DATAPROVIDER_EXCEPTION          = 20
    CONTROL_FLUSH_ERROR             = 21
    OTHERS                          = 22.
file = lv_filename.