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

FM GUI_DOWNLOAD

Hi

I am using FM 'GUI_DOWNLOAD' to download the data in Excel format. Now i am able to download the data in proper format bur unable to download the header of the columns. Can anyone have solution to this??

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • Posted on Sep 21, 2007 at 01:50 PM

    Yes, it is possible to download column headers with GUI_DOWNLOAD. To do this,

    you must provide the parameter FIELDNAMES with a corresponding table:

    This table must be a single-line table.

    The following is a corresponding "showcase" source code:

    REPORT reportname.

    " Declaration of Line Type: SPFLI *

    TYPES: BEGIN OF line_type,

    field1 LIKE spfli-carrid,

    field2 LIKE spfli-connid,

    field3 LIKE spfli-cityfrom,

    END OF line_type.

    " Declaration of Table Type *

    TYPES tab_type TYPE STANDARD TABLE OF line_type.

    " Declaration of internal Table *

    DATA: itab TYPE tab_type.

    " Declaration of workarea *

    DATA: wa TYPE line_type.

    " Declaration of Fieldnames *

    DATA: BEGIN OF colnames OCCURS 0,

    col(10) TYPE c,

    END OF colnames.

    " One Colname per line *

    colnames-col = 'Column1'. APPEND colnames.

    colnames-col = 'Column2'. APPEND colnames.

    colnames-col = 'Column3'. APPEND colnames.

    START-OF-SELECTION.

    " Get the data and fill the workarea *

    SELECT carrid connid cityfrom

    FROM spfli

    INTO (wa-field1, wa-field2, wa-field3).

    APPEND wa TO itab.

    ENDSELECT.

    IF sy-subrc <> 0.

    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

    ENDIF.

    " Now download the itab with fieldnames: *

    " By using dat_mode and fieldseparator *

    CALL FUNCTION 'GUI_DOWNLOAD'

    EXPORTING

    filename = 'C:\TEMP\test.txt'

    filetype = 'ASC'

    dat_mode = 'X'

    write_field_separator = 'X'

    TABLES

    data_tab = itab

    fieldnames = colnames

    EXCEPTIONS

    OTHERS = 1.

    if sy-subrc <> 0.

    message i398(00) with 'Error: ' sy-subrc 'during gui_download!'.

    endif.

    Add a comment
    10|10000 characters needed characters exceeded

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.