Skip to Content
author's profile photo Former Member
Former Member

download data to file

hi,

all the data i need to dispaly in the output is in final internal table gt_final.

whereas the problem i need to download this data to excelsheet.

please let me know what are the varibles i need to pass to the FM GUI_DOWNLOAD

where i need to write this FM.

Please help me

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

6 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Oct 30, 2008 at 07:10 AM

    Hi,

    Check the function module documentation in SE37, it has a example code.

    Thanks & Regards,

    Navneeth K.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Oct 30, 2008 at 07:10 AM

    Hi,

    Pass values like this...

        CALL METHOD gui_download
          EXPORTING
            filename                = w_file_name
            filetype                = 'DAT'
          CHANGING
            data_tab                = <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
            not_supported_by_gui    = 22
            error_no_gui            = 23
            OTHERS                  = 24.
    

    Regards

    Debarshi

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Oct 30, 2008 at 07:12 AM

    hi,

    you can just pass file name where you want to stor and your final table name.

    DATA : file_name TYPE string.
    data:file(45) TYPE c .
    
    CONCATENATE 'c:\' 'Data' '_' sy-datum '.txt' INTO file.
    
      file_name = file.
    
     CALL FUNCTION 'GUI_DOWNLOAD'
        EXPORTING
    *   BIN_FILESIZE                    =
          filename                        = file_name
          filetype                        = 'ASC'
          append                          = 'X'
        TABLES
          data_tab                        = it_final
                .
    

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Oct 30, 2008 at 07:14 AM

    hi frnd,

    call fm gui_download ....pass your internal table name and and the file path where you want to download file as excel file .

    Thanks and regards .

    Priyank dixit

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Oct 30, 2008 at 07:23 AM

    Hi hema,

    file_name = file.

    CALL FUNCTION 'GUI_DOWNLOAD'

    EXPORTING

    • BIN_FILESIZE =

    filename = file_name

    filetype = 'ASC'

    append = 'X'

    TABLES

    data_tab = it_final

    Use this code to download the file.

    Regards,

    PK

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Oct 30, 2008 at 07:30 AM

    Hi Hema,

    You can use the below sample Program for your reference.

    *&---------------------------------------------------------------------*
    *& Report  ZCC_EXCEL_DOWNLOAD
    *&
    *&---------------------------------------------------------------------*
    *&
    *&
    *&---------------------------------------------------------------------*
    
    REPORT  ZCC_EXCEL_DOWNLOAD.
    TYPE-POOLS:
                sydes.
    
    data : Begin of t_header occurs 0,
           name(30) type c,
           end of t_header.
    
    data : Begin of itab occurs 0,
           fld1 type char10,
           fld2 type char10,
           fld3 type char10,
           end   of itab.
    
     DATA: v_pass_path TYPE string value 'c:\excel\test.xlsx'..
    
     DATA: sy_repid LIKE sy-repid,
            td       TYPE sydes_desc.
      sy_repid = sy-repid.
    
    
    
    
    append itab.
    itab-fld1 = 'Hi'.
    itab-fld2 = '100.00'.
    itab-fld3 = 'welcome'.
    append itab.
    append itab.
    append itab.
    append itab.
    append itab.
    
    t_header-name = 'Field1'.
    append t_header.
    t_header-name = 'Field2'.
    append t_header.
    t_header-name = 'Field3'.
    append t_header.
    
     DESCRIBE FIELD itab INTO td.
    
      CALL FUNCTION 'GUI_FILE_SAVE_DIALOG'
        EXPORTING
          default_extension     = 'XLS'
        IMPORTING
          fullpath              = v_pass_path.
    
      CALL FUNCTION 'GUI_DOWNLOAD'
        EXPORTING
          filename                        = v_pass_path
          filetype                        = 'DBF'
        TABLES
          data_tab                        = itab
          FIELDNAMES                      = t_header
          .
    
    

    Thanks,

    Chidanand

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      hi,

      ihave written the following code to download.

      the download was successfull but i am getting extra columns with zeros

      and i need to set default file name as data_sy-datum.

      the filename i am not getting which i have set.

      please check the below code and sugest me

      s_name = sy-datum.

      DATA: v_pass_path TYPE string value 'C:\Documents and Settings\latha\Desktop\'.

      concatenate v_pass_path s_name into v_file1.

      CALL FUNCTION 'GUI_FILE_SAVE_DIALOG'

      EXPORTING

      default_extension = 'XLS'

      IMPORTING

      fullpath = v_file1.

      CALL FUNCTION 'GUI_DOWNLOAD'

      EXPORTING

      filename = v_file1

      filetype = 'DBF'

      TABLES

      data_tab = GT_FINAL

      • FIELDNAMES = t_header

      .

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.