Skip to Content
avatar image
Former Member

header in 'gui_download'

Hi All,

I use 'GUI_DOWNLOAD' to download data from internal table to excel.I am passing the heading in the header field of function module.

call FUNCTION 'GUI_DOWNLOAD'

EXPORTING

FILENAME = lv_file

FILETYPE = 'ASC'

write_field_separator = 'X'

header = lv_header

TABLES

data_tab = t_output.

header is of type XTRING in the function module.

if i declare my variable as type string it shows a runtime dump due to type mismatch.

I am not able to declare it as type xstring.can anyone advice on how to declare a variable as type xstring or any other way to solve my problem.

Thanks & Regards,

Subasree

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Best Answer
    avatar image
    Former Member
    Sep 25, 2008 at 10:52 AM

    Hi,

    to download header call GUI_DOWNLOAD twice.

    Once to download Header of the internal table and next time to download data of internal table,

    Check this link, in this link I've posted one sample code

    to download heading and data of internal table

    how-to-create-column-header-text-while-downloading

    Regards

    Abhijeet

    Add comment
    10|10000 characters needed characters exceeded

  • Sep 25, 2008 at 10:55 AM

    try this

    data:begin of excel_heading,

    text(20) type c,

    end of excel_heading.

    data:it_heading like standard table of excel_heading initial size 0.

    *--Generate the heading for excel data

    excel_heading-text = 'A'.

    append excel_heading to it_heading.

    excel_heading-text = 'B'.

    append excel_heading to it_heading.

    excel_heading-text = 'C'.

    append excel_heading to it_heading.

    excel_heading-text = 'D'.

    append excel_heading to it_heading.

    call function 'GUI_DOWNLOAD'

    exporting

    filename = p_pfile

    filetype = 'DAT'

    write_field_separator = '#'

    header = '00'

    trunc_trailing_blanks = 'X'

    show_transfer_status = 'X'

    tables

    data_tab = p_it_final[]

    fieldnames = it_heading[].

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Sep 25, 2008 at 10:53 AM

    your internal table will have say 10 fields....

    now, just before downloading to excel fill the 10 fields with header details....

    itab-field1 = header1.

    itab-field2 = header2.

    ............

    ...........

    itab-field9 = header9.

    itab-field10 = header10.

    append itab index 1.

    so, when you download the header data also gets downloaded..No need to use header option in gui_download...

    Add comment
    10|10000 characters needed characters exceeded