05-24-2010 9:49 AM
Hi,
I have a requirement , Which I m downloading the contents of internal table using the GUI_DOWNLOAD in excel format, I need to keep the first line of the excel sheet as a header, Can any one suggest how to go for this,
05-24-2010 10:32 AM
Hi,
Write your code as below:
DEFINE add_field_header.
clear &1.
&1-field = &2.
append &1.
END-OF-DEFINITION.
add_field_header heading 'Column 1'.
add_field_header heading 'Column 2'.
add_field_header heading 'Column 3'.
add_field_header heading 'Column 4'.
add_field_header heading 'Column 5'.
.......
.......
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filename = filename
filetype = 'DAT'
TABLES
data_tab = itab
fieldnames = heading
EXCEPTIONS
file_open_error = 1
file_write_error = 2
invalid_filesize = 3
invalid_type = 4
no_batch = 5
unknown_error = 6
invalid_table_width = 7
gui_refuse_filetransfer = 8
customer_error = 9
OTHERS = 10.
Regards,
Ni3
05-24-2010 10:34 AM
Hello,
You can have the data in the data tab & field name in the field tab. And so you can download both the field name and the value for the same using the FM u2013 GUI_DOWNLOAD (File type should be u2018ASCu2019).
Hope, you need additional information to be added as the header.
One option: You can call the GUI_UPLOAD twice.
First one with the header in the data tab.
Second one with the option append = u2018Xu2019 with the actual data and header and pass the same above file name as input.
Also, there is a solved forum already exists but with a different solution. You can go through the below link also:
Regards,
Selva K.
05-24-2010 11:25 AM
05-24-2010 11:33 AM
Create a type, for example
types: BEGIN OF t_feld,
name(40) TYPE c,
END OF t_feld.
Data: it_feld type table of t_feld.
Assign the fieldname to the name and append it to the internal table it_feld.
Regards,
Selva K.