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: 

header in 'gui_download'

Former Member
0 Kudos

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

1 ACCEPTED SOLUTION

Former Member
0 Kudos

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

Regards

Abhijeet

3 REPLIES 3

Former Member
0 Kudos

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

Regards

Abhijeet

Former Member
0 Kudos

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...

kesavadas_thekkillath
Active Contributor
0 Kudos

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[].