How to format sy-datum in various routines in SAP BI
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’
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.
Would you like to access Full Article?
If you are already a member in this website, Please Click here to loginIf you are not yet a member, Please Click here to Sign up
New NetWeaver Information at SAP.com