Skip to Content
0
Sep 08, 2009 at 05:39 AM

Excel format is completely lost after download?

194 Views

Hi all,

In the below excel download program, i am able to download 2 internal tables which will be appended to a single sheet in excel.

But the format is completely lost in the output. How do i retain the format after downloading.

Appreciate your help in this.

REPORT ZXLSDOWNLOAD line-size 400.

types: begin of t_dat,

fld1(30) type c,

fld2(30) type c,

end of t_dat.

TYPES: BEGIN OF ty_heading ,

text(100) TYPE c,

END OF ty_heading.

DATA:i_heading TYPE STANDARD TABLE OF ty_heading,

w_heading TYPE ty_heading.

data: it_dat1 type table of t_dat,

it_dat2 type table of t_dat,

wa_dat type t_dat.

wa_dat-fld1 = '12345678901234567890'.

wa_dat-fld2 = '00000000000000043210'."->ur input

append wa_dat to it_dat1.

wa_dat-fld1 = '12345678901234567890'.

wa_dat-fld2 = '00000000000000543210'."->ur input

append wa_dat to it_dat1.

CLEAR: w_heading.

w_heading-text = 'FIELD1'.

APPEND w_heading TO i_heading.

CLEAR: w_heading.

w_heading-text = 'FIELD2'.

APPEND w_heading TO i_heading.

CALL FUNCTION 'GUI_DOWNLOAD'

EXPORTING

filename = 'C:\Documents and Settings\Subba.Krishna\Desktop\fff.xls'

filetype = 'DAT'

write_field_separator = 'X'

append = ' '

wk1_N_format = 'X'

TABLES

data_tab = it_dat1

fieldnames = i_heading

EXCEPTIONS

file_write_error = 1

no_batch = 2

gui_refuse_filetransfer = 3

invalid_type = 4

no_authority = 5

unknown_error = 6

header_not_allowed = 7

separator_not_allowed = 8

filesize_not_allowed = 9

header_too_long = 10

dp_error_create = 11

dp_error_send = 12

dp_error_write = 13

unknown_dp_error = 14

access_denied = 15

dp_out_of_memory = 16

disk_full = 17

dp_timeout = 18

file_not_found = 19

dataprovider_exception = 20

control_flush_error = 21

OTHERS = 22.

Thanks,

Subba

output

FIELD1 FIELD2

1.23457E+19 43210

1.23457E+19 543210