Skip to end of metadata
Go to start of metadata

DOWNLOAD

DOWNLOAD is obsolete function module for storing SAP data in a file in the file system of the presentation server.

 CALL FUNCTION 'DOWNLOAD'
  IMPORTING
*   BIN_FILESIZE                  = ' '
*   CODEPAGE                      = ' '
    FILENAME                      =  filename
    FILETYPE                       =  'ASC'
    ITEM                              = 'Hierarchy'(t17)
*   MODE                          = ' '
*   WK1_N_FORMAT                  = ' '
*   WK1_N_SIZE                    = ' '
*   WK1_T_FORMAT                  = ' '
*   WK1_T_SIZE                    = ' '
*   FILEMASK_MASK                 = ' '
*   FILEMASK_TEXT                 = ' '
*   FILETYPE_NO_CHANGE            = ' '
*   FILEMASK_ALL                  = ' '
*   FILETYPE_NO_SHOW              = ' '
*   SILENT                        = 'S'
*   COL_SELECT                    = ' '
*   COL_SELECTMASK                = ' '
*   NO_AUTH_CHECK                 = ' '
* EXPORTING
*   ACT_FILENAME                  =
*   ACT_FILETYPE                  =
*   FILESIZE      =
*   CANCEL     =
  TABLES
    DATA_TAB                      = lt_datatab
*   FIELDNAMES                    =
 EXCEPTIONS
   FILE_OPEN_ERROR               = 1
   FILE_WRITE_ERROR              = 2
   INVALID_FILESIZE              = 3
   INVALID_TYPE                  = 4
   NO_BATCH                      = 5
   UNKNOWN_ERROR                 = 6
   INVALID_TABLE_WIDTH           = 7
   GUI_REFUSE_FILETRANSFER       = 8
   CUSTOMER_ERROR                = 9
   NO_AUTHORITY                  = 10
   OTHERS                        = 11
.

So we will be using the method `GUI_DOWNLOAD` of the class `CL_GUI_FRONTEND_SERVICES`. Now in 4.6, while using FM DOWNLOAD, a pop-up used to appear, prompting you to to put the path to save the file. To get the same functionality in GUI_DOWNLOAD use code as below-

DATA : filename_new TYPE string,
       l_filename TYPE string,     
       l_fullpath TYPE string,     
       l_path TYPE string.
MOVE filename TO filename_new.

CALL METHOD cl_gui_frontend_services=>file_save_dialog
EXPORTING      
     default_file_name = filename_new
CHANGING     
     filename                      = l_filename    
     path                          = l_path   
     fullpath                      = l_fullpath.
IF sy-subrc <> 0.
ENDIF.

CALL METHOD cl_gui_frontend_services=>gui_download
EXPORTING    
      filename          = l_fullpath     
    filetype             = 'ASC'   
   append                = 'X'
TABLES     
    data_tab             = lt_datatab
EXCEPTIONS       
    OTHERS               = 1.

If 'DOWNLOAD' has filetype as 'DAT' then no change. Same applies for 'WS_DOWNLOAD'.

  • No labels