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: 

How to put the header in excel file in GUI_DOWNLOAD

Former Member
0 Kudos

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,

4 REPLIES 4

former_member434229
Active Participant
0 Kudos

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

Former Member
0 Kudos

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.

0 Kudos

How do I can declare the FieldNames Parameter

0 Kudos

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.