Hi Friends,

I have worked in various implementations of Routines, Transformation routines and DTP routines and exit variable creations in Business Warehousing, where we have extensive use of changing the format of system date. So I thought to make a consolidated blog which will have all the ways we can format a sy-datum or syst-datum variable.

By 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.

* By 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

* Converts date from 20010901 to 01SEP2001

gd_date = sy-datum.

CALL FUNCTION ‘CONVERSION_EXIT_IDATE_OUTPUT’

EXPORTING

input = gd_date

IMPORTING

OUTPUT = gd_date.

By this way we can change the date format and use them for reporting. PFB some more Function modules which will have more options to make things more easier and fill the Gap with the client need.

CONVERSION_EXIT_PDATE_OUTPUT

Eg: input = 24012008 and output = 24.01.2008

CONVERSION_EXIT_SDATE_OUTPUT

Eg: input = 20070201 and output = 01.FEB.2007

CONVERSION_EXIT_IDATE_INPUT

Eg: input = 01.02.2008 and Output = 20080201

CONVERSION_EXIT_LDATE_OUTPUT

Eg: input = 20070301 and output = 01. March 2007

CONVERSION_EXIT_PDATE_OUTPUT

Eg: input = 20070301 and output = 03.01.2007

Hope this will helps a BI technical consultant while making use of these FMs in Transformations and various routines.

Source:

https://help.sap.com/saphelp_erp60_sp/helpdata/en/9f/dba1ef35c111d1829f0000e829fbfe/content.htm

https://help.sap.com/saphelp_470/helpdata/en/9f/dba1ef35c111d1829f0000e829fbfe/content.htm

New NetWeaver Information at SAP.com

Very Helpfull

 

 

User Rating: Be the first one !