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: 

Formatting the date in an output file

Former Member
0 Kudos

Greetings Abapers

I am writing a program which outputs a file in csv format. Currently the date is shown in the file as 20080609000000 but i would like it to be shown as 09.06.2008. Help anyone?

5 REPLIES 5

Former Member
0 Kudos

Hi,

Declare a variable of type ' C ' lenght 10 and pass the date into that variable.

now u can easily download the date into CSV format

Best regards,

raam

Former Member
0 Kudos

Hi Mandimika,

declare a variable:

dl_ddate(10) type C.

*move the date to be written tp the file to this variable

WRITE DS_FINAL-EINDT TO DL_DDATE MM.DD.YYYY NO-ZERO.

Hope this helps,

Keerthi.

Former Member
0 Kudos

it seems that you have concatenated timestamp with year .

just concatenate w_a+6(2)

'.'

w_1+2(2)

'.'

w_a(4)

into w_b .

now move this field w_b to excel

Former Member
0 Kudos

  PERFORM format_date USING v_begda CHANGING w_cdate.
FORM format_date  USING    i_date
                  CHANGING r_date.

  r_date+0(2) = i_date+6(2).
  r_date+2(1) = '.'.
  r_date+3(2) = i_date+4(2).
  r_date+5(1) = '.'.
  r_date+6(4) = i_date+0(4).

ENDFORM.                    " format_date

Former Member
0 Kudos

you can also use WRITE TO statement

eg


data: unformated(8) type c,
        formated(10) type c.
          WRITE unformated TO formated DD/MM/YYYY.