Skip to Content
Author's profile photo chandan praharaj

How to format sy-datum in various routines in SAP BI

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.



  input = gd_date


  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.


Eg: input = 24012008 and output = 24.01.2008


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


Eg: input = 01.02.2008 and Output = 20080201


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


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.


Assigned Tags

      1 Comment
      You must be Logged on to comment or reply to a post.
      Author's profile photo Vinay Kumar
      Vinay Kumar


      Where Can we see which format the 'sy-datum' takes ?

      please reply in detail .


      Thanks in Advance.