05-20-2009 7:23 AM
Hi Experts,
How can i get a file header using this method cl_gui_frontend_services=>gui_download
Thanks
Basu
05-20-2009 7:29 AM
Hi Kari,
For having the header in the internal table, all the fields must have type C. So, just fill the fields with the header text and insert at index 1.
CALL METHOD cl_gui_frontend_services=>gui_download
EXPORTING
filename = <Your file name>
filetype = 'TXT'
CHANGING
data_tab = i_data
EXCEPTIONS
file_write_error = 1
no_batch = 2
Regards,
Swapna.
05-20-2009 7:26 AM
Hi,
Try this.
Append the file header as the first line in the internal table(the table contents which u use in the download). If you want to give column headings, you can give it through "FIELDNAMES" in the tables section of the "GUI_DOWNLOAD".
Hope this may be helpful.
Regards,
Sharin.
05-20-2009 7:29 AM
Hi Kari,
For having the header in the internal table, all the fields must have type C. So, just fill the fields with the header text and insert at index 1.
CALL METHOD cl_gui_frontend_services=>gui_download
EXPORTING
filename = <Your file name>
filetype = 'TXT'
CHANGING
data_tab = i_data
EXCEPTIONS
file_write_error = 1
no_batch = 2
Regards,
Swapna.
05-20-2009 7:30 AM
Hi,
You can use the FM - GUI_DOWNLOAD to specify the headers. It can be done in the following manner -
TYPES: BEGIN OF ty_head, "Structure for header
h(10) TYPE c,
END OF ty_head.
DATA: it_head TYPE TABLE OF ty_head WITH HEADER LINE.
"Adding header details
it_head-h = 'Field1'.
APPEND it_head.
it_head-h = 'Field2'.
APPEND it_head.
it_head-h = 'Field3'.
APPEND it_head.
it_head-h = 'Field4'.
APPEND it_head.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filename = p_file
filetype = 'ASC'
write_field_separator = 'X'
header = '00' "<= note this
TABLES
data_tab = it_tab
fieldnames = it_head[] "<= Pass your header table here
EXCEPTIONS
OTHERS = 1.
Hope this helps.
Regards,
Himanshu