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: 

excel

Former Member
0 Kudos

hello!

i used gui_download in order to create an excel file.

i need to add columns heading to the file before downloading it.

i try to add hard code text into the table for each field, and the insert the line into the table as first line,but some of the table fields are numeric and i get dump.

how can i add a column line to the internal table before downloading it?

regards

yifat

1 ACCEPTED SOLUTION

athavanraja
Active Contributor
0 Kudos

lets say you want to download a itab with four columns.

create another itab with four columns,

like

data: begin of h_itab occurs 0 with header line ,

fc(30),

sc(30),

tc(30),

frc(40) ,

end of h_itab .

move: 'column1 title' to h_itab-fc ,

'column2 title' to h_itab-sc ,

'column3 title' to h_itab-tc ,

'column4 title' to h_itab-frc ,

append h_itab .

first download h_itab using GUI_DOWNLOAD to say file name c:/tem.xls

again call GUI_DOWNLOAD to download the itab which is holding the data to the same location (c:/tem.xls), but this time when calling GUI_DOWNLOAD pass 'X' to parameter <b>APPEND</b>.

Hope this is clear.

Regards

Raja

3 REPLIES 3

Former Member
0 Kudos

HI Yifat

You need to call gui_download twice, Once with the header and next time with the data....

Make sure that when you call the gui_download next time you append the data inside it...

Regards

Mithlesh

athavanraja
Active Contributor
0 Kudos

lets say you want to download a itab with four columns.

create another itab with four columns,

like

data: begin of h_itab occurs 0 with header line ,

fc(30),

sc(30),

tc(30),

frc(40) ,

end of h_itab .

move: 'column1 title' to h_itab-fc ,

'column2 title' to h_itab-sc ,

'column3 title' to h_itab-tc ,

'column4 title' to h_itab-frc ,

append h_itab .

first download h_itab using GUI_DOWNLOAD to say file name c:/tem.xls

again call GUI_DOWNLOAD to download the itab which is holding the data to the same location (c:/tem.xls), but this time when calling GUI_DOWNLOAD pass 'X' to parameter <b>APPEND</b>.

Hope this is clear.

Regards

Raja

Former Member
0 Kudos

Hi,

*declare an internal table it_header and it_downloads to *download the data

data:begin of it_header occurs 0,

string(100),

end of it_header.

Perform Insert_header.

Call Function GUI_DOWNLOAD

exporting

filename = c:\xyz.xls

filetype = DAT

tables

data_tab = it_download

fieldnames = it_header

exceptions

...

...

if sy-subrc <> 0.

endif.

Form Insert_header.

it_header-string = text-001.

append it_header.Clear it_header.

it_header-string = text-002.

append it_header.Clear it_header.

it_header-string = text-003.

append it_header.Clear it_header.

it_header-string = text-004.

append it_header.Clear it_header.

Endform.

Please reward points if it is helpful.

Thanks,

Pramod