Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

REGARDING GUI_DOWNLOAD

Former Member
0 Kudos

hi ,

i want to download internal table data to desktop in excel format

please give the parameters to be passed nad the file path

2 REPLIES 2

Former Member
0 Kudos

Hi,

Welcome to SDN

I found that you are new member of this forum. And I think you have to read [Rules of Engagement|https://www.sdn.sap.com/irj/sdn/wiki?path=/display/home/rulesofEngagement] of this forum.

Please search through this website (sdn.sap.com) and I beliave that you will find to many article, sample code, wiki content and forum question that answer your question.

For sample, check this out: [ABAP to Down Load Content of SAP Table in to Excel |https://www.sdn.sap.com/irj/sdn/wiki?path=/display/snippets/abaptoDownLoadContentofSAPTableintoExcel].

Regards,

$=====$

Are you newbie? Check this out: [Rules of Engagement|https://www.sdn.sap.com/irj/sdn/wiki?path=/display/home/rulesofEngagement]

Mohamed_Mukhtar
Active Contributor
0 Kudos

hi Venkat,

Check the code below...

PARAMETERS : p_dload TYPE rlgrap-filename.
DATA : w_dload TYPE string.

TYPES : BEGIN OF ty_kna1,      " structure
        kunnr TYPE kna1-kunnr,
        name1 TYPE kna1-name1,
        ort01 TYPE kna1-ort01,
        land1 TYPE kna1-land1,
        END OF ty_kna1.

DATA :  it_kna1 TYPE TABLE OF ty_kna1.  "body

AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_dload.
  PERFORM f_dload.
START-OF-SELECTION.

  PERFORM f_extract.
  PERFORM f_download.  " download file to presentation server
*&---------------------------------------------------------------------*
*&      Form  f_dload
*&---------------------------------------------------------------------*
FORM f_dload .
  CALL FUNCTION 'F4_FILENAME'
* EXPORTING
*   PROGRAM_NAME        = SYST-CPROG
*   DYNPRO_NUMBER       = SYST-DYNNR
*   FIELD_NAME          = ' '
    IMPORTING
      file_name           = p_dload
             .

ENDFORM.                    " f_dload
*&---------------------------------------------------------------------*
*&      Form  f_extract
*&---------------------------------------------------------------------*
FORM f_extract .
  SELECT kunnr
          name1
          ort01
          land1 FROM kna1 INTO TABLE it_kna1 .
ENDFORM.                    " f_extract

*&---------------------------------------------------------------------*
*&      Form  f_download
*&---------------------------------------------------------------------*
FORM f_download .
  w_dload = p_dload.
  CALL FUNCTION 'GUI_DOWNLOAD'
    EXPORTING
*   BIN_FILESIZE                    =
      filename                        = w_dload
   filetype                        = 'ASC'
*   APPEND                          = ' '
   write_field_separator           = 'X'
*   HEADER                          = '00'
*   TRUNC_TRAILING_BLANKS           = ' '
*   WRITE_LF                        = 'X'
*   COL_SELECT                      = ' '
*   COL_SELECT_MASK                 = ' '
*   DAT_MODE                        = ' '
*   CONFIRM_OVERWRITE               = ' '
*   NO_AUTH_CHECK                   = ' '
*   CODEPAGE                        = ' '
*   IGNORE_CERR                     = ABAP_TRUE
*   REPLACEMENT                     = '#'
*   WRITE_BOM                       = ' '
*   TRUNC_TRAILING_BLANKS_EOL       = 'X'
*   WK1_N_FORMAT                    = ' '
*   WK1_N_SIZE                      = ' '
*   WK1_T_FORMAT                    = ' '
*   WK1_T_SIZE                      = ' '
* IMPORTING
*   FILELENGTH                      =
    TABLES
      data_tab                        = it_kna1
*   FIELDNAMES                      =
 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
            .
  IF sy-subrc <> 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
            WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
  ENDIF.
ENDFORM.                    " f_download

With Regards..

Always Learner