09-25-2008 11:50 AM
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
09-25-2008 11:52 AM
09-25-2008 11:52 AM
09-25-2008 11: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...
09-25-2008 11: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[].