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: 

Problem with Excel Download

Former Member
0 Kudos

Hi everyone, i call the function GUI_DOWNLOAD to download an intern table into Excel format.

the problem is

a field for exemple tab1-f1 = '4.5', but after downloaded into excel, it turns out automatically into Date format. which shows. 04.May.(i used German office version).

by the way i define the intern table like

types: begin of ts_tval,

aubel(20),

posnr(20) ,

matnr(20) ,

vbeln(20) ,

posnr_re(20) ,

atinn(20) ,

atnam(20) ,

atkla(20) ,

atwrt(20) ,

atflv(20) ,

end of ts_tval,

data lt_tval type table of ts_tval.

then the field will be valued as:

lt_tval-atwrt = cawn-atwrt.

anyone can tell how to set the format of excel cells???

thanx a loooot!!!!!!

10 REPLIES 10

Former Member
0 Kudos

Hi ,

Keep the cursor on the cell of your excel sheet and right click , go to format cell , click the number tab and select the general category. I think it will solve your problem

0 Kudos

hi, thanx for reply, but no

i tried,

if u correct it in excel, it will turn 04.Mai into 39937 because actually the value is already turned into 04.05.2009

so here is the programm i wrote

types: BEGIN OF t_interface ,

var1(4) TYPE c ,

END OF t_interface .

data t_tab type table of t_interface.

data wa_var type t_interface.

wa_var-var1 = '3.00'.

APPEND wa_var to t_tab.

wa_var-var1 = '4.5'.

APPEND wa_var to t_tab.

CALL FUNCTION 'GUI_DOWNLOAD'

EXPORTING

  • BIN_FILESIZE =

filename = 'C:\temp\file_test.xls'

filetype = 'ASC'

TABLES

data_tab = t_tab

  • FIELDNAMES =

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

0 Kudos

Hi ,

Change file type as 'DAT' like -

CALL FUNCTION 'WS_DOWNLOAD'

EXPORTING

FILENAME = P_FILENM

FILETYPE = 'DAT'

0 Kudos

USe GUI_DOWNLOAD not WS_DOWNLOAd

0 Kudos

sorry, i tried data type = 'DAT', it doesnt work, Using GUI_DOWNLOAD, whether FILETYPE = 'DAT' or 'ASC', if it is opened in Excel, it shows 04.Mai instead of 4.5,

can anyone help???

former_member202957
Contributor
0 Kudos

Hi yunfan Wang ,

Just clik on the cell Right click -> format cells -> Number Tab - > Catergory: Number.

Try this it will be helpful

Regards,

Sunil kairam.

0 Kudos

Sunil kairam

Thanx for ur reply

I have already tried this, as i said above, the '4.5' is changed automatically to date format, 04.05.2009, if i do what u said in Number Catelog-> Number, it will be 39973, not back to 4.5.

0 Kudos

Hi,

Declare wa_var as shown below

data wa_var type t_interface-var1.

Regards,

sunil kairam.

0 Kudos

Hi sunil kairam.

thanx,

but it will be syntax error if i define wa_var like u said.

by the way, i solved the problem in some other way,

i used CONCATENATE to add SPACE infront of the value 4.5 , then in German Excel , it will not be translated into Date format, but kept as 4.5.

anyway, thanx for the help, and all u guys.

kesavadas_thekkillath
Active Contributor
0 Kudos

try declaring tab1-f1 as character format