Formating a date field

sengaja saya copy dari web http://www.sapdev.co.uk/tips/date/date_format.htm biar ga lupa 😀

Using the WRITE statement

data: gd_date(10). "field to store output date

*Converts SAP date from 20020901 to 01.09.2002
write sy-datum to gd_date dd/mm/yyyy.
*Converts SAP date from 20020901 to 01.09.02
write sy-datum to gd_date dd/mm/yy.

Using data manipulation techniques

data: gd_date(8). "field to store output date

*Converts SAP date from 20010901 to 01092001
gd_date(2) = sy-datum+6(2).
gd_date+2(2) = sy-datum+4(2).
gd_date+4(4) = sy-datum(4).

Using Function modules

data: gd_date(8). "field to store output date

*Converts date from 20010901 to 01SEP2001
gd_date = sy-datum.
CALL FUNCTION 'CONVERSION_EXIT_IDATE_OUTPUT'
EXPORTING
  input = gd_date
IMPORTING
  OUTPUT = gd_date.
Advertisements

One comment

  1. I’m really loving the theme/design of your weblog.

    Do you ever run into any web browser compatibility issues?
    A couple of my blog audience have complained about
    my blog not working correctly in Explorer but looks great in Chrome.

    Do you have any solutions to help fix this issue?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s