Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

FM for downloading to an Excel file

I want to download an internal table data to an excel sheet.Which FM should i use also tell me how should each column value go under the appropriate field name.

Regards,

Linda

Tags:
Former Member
Former Member replied

hiii

use following FM

..here need to pass internal table like i_output in following code..and column of excel sheet will arrange data as per the fields of internal table.

FORM get_download_data USING p_pfile .

  DATA:
    lw_file TYPE string .
                                       " File Path
    lw_file = p_pfile.


  CALL FUNCTION 'GUI_DOWNLOAD'
    EXPORTING
*   BIN_FILESIZE                    = BIN_FILESIZE
      filename                        = lw_file
      filetype                        = 'DBF'
*   APPEND                          = ' '
   write_field_separator           = 'X'
*   HEADER                          = '00'
*   TRUNC_TRAILING_BLANKS           = 'X'
*   WRITE_LF                        = 'X'
*   COL_SELECT                      = 'X'
*   COL_SELECT_MASK                 = p_col_sel
*   DAT_MODE                        = ' '
*   CONFIRM_OVERWRITE               = ' '
*   NO_AUTH_CHECK                   = ' '
*   CODEPAGE                        = ' '
*   IGNORE_CERR                     = ABAP_TRUE
*   REPLACEMENT                     = '#'
*   WRITE_BOM                       = ' '
*   TRUNC_TRAILING_BLANKS_EOL       = 'X'
*   WK1_N_FORMAT                    = '0'
*   WK1_N_SIZE                      = ' '
*   WK1_T_FORMAT                    = ' '
*   WK1_T_SIZE                      = ' '
* IMPORTING
*   FILELENGTH                      = FILELENGTH
    TABLES
      data_tab                        = i_output
      fieldnames                      = i_final
    EXCEPTIONS
      file_write_error                = 1
      no_batch                        = 2
      gui_refuse_filetransfer         = 3
      invalid_type                    = 4

regards

twinkal

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question