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: 

date format changing in excel file

Bharath84
Participant
0 Kudos

Hi All,

Below is my data type for date field.

data : begin of t_date occurs 0          ,

       p_date(10)   type c              ,

       belnr    like bkpf-belnr         ,

       end of t_date                     .


data :   w_budat(10) type c    .

values in final internal table t_date in debugging:

P_Date

12/06/2008

12/06/2008

24/06/2008

24/06/2008

I am downloading the data to excel file using ws_download. Below is the date in excel file.

Posting DT

12/6/2008

12/6/2008

24/06/2008

24/06/2008

why the first 2 records are having different format in excel file. Please help me.

Thanks,

HT

1 ACCEPTED SOLUTION

Bharath84
Participant
0 Kudos

Solved !  used FM CONVERT_DATE_TO_EXTERNAL.

Thanks,

HT

6 REPLIES 6

Former Member
0 Kudos

Hello

It might be because of Excel formatting.

Try putting an apostrophe (') before the date. Excel treats all values with an apostrophe in front of as a string.

regards

Former Member
0 Kudos

Hi Haritha,

Could you please let us know what else parameters are you passing to ws_download function module.

If possible try to use GUI_DOWNLOAD function module as WS_download is Obsolete .

Regards,

Pravin

0 Kudos

Hi Pravin,

This is 4.0B version. So there is no GUI_DOWNLOAD.

Below are the parameters that I passed.

  call function 'WS_DOWNLOAD'

      exporting

*         BIN_FILESIZE            = ' '

*         CODEPAGE                = ' '

           filename                = p_file

         filetype                = 'DAT'

*         MODE                    = ' '

*         WK1_N_FORMAT            = ' '

*         WK1_N_SIZE              = ' '

*         WK1_T_FORMAT            = ' '

*         WK1_T_SIZE              = ' '

*         COL_SELECT              = ' '

*         COL_SELECTMASK          = ' '

*         NO_AUTH_CHECK           = ' '

*    IMPORTING

*         FILELENGTH              =

       tables

            data_tab                = t_date

            fieldnames              = col_head

       exceptions

            file_open_error         = 1

            file_write_error        = 2

            invalid_filesize        = 3

            invalid_table_width     = 4

            invalid_type            = 5

            no_batch                = 6

            unknown_error           = 7

            gui_refuse_filetransfer = 8

            others                  = 9.

Also I observed something.

In my code I have 2 statements.

at new zbelnr.

-----

endat.

t_date-p_date = w_budat.

append t_date.

clear t_date.

at new class.

t_date-p_date = w_budat.

append t_date.

clear t_date.

endat.

after at new...endat statement the records appended are coming as

12/6/2008

12/6/2008

but the records appended inside at new class...endat are coming correctly as

24/06/2008

24/06/2008

after the ws_download also, values in final internal table t_date in debugging are showing correctly.

P_Date

12/06/2008

12/06/2008

24/06/2008

24/06/2008

Thanks,

HT

Former Member
0 Kudos

Hello Haritha,

If you run this report online use OLE.

Thanks

Sam

former_member201275
Active Contributor
0 Kudos

You have to maintain your excel settings correctly, and then open the file with the excel wizard.

Bharath84
Participant
0 Kudos

Solved !  used FM CONVERT_DATE_TO_EXTERNAL.

Thanks,

HT