Convert the date to the format of user that is running ?

This tip shows how to convert the sy-datum to the current user date format.

This tip shows how to convert the sy-datum to the current user date format.

The attached function module can do this work.


 

FUNCTION Z_CONV_SYDATE_TOUSER. 
*"---------------------------------------------------------------------- 
*"*"Interface local: 
*" IMPORTING 
*" REFERENCE(DATUME) LIKE USR01-HDEST 
*" REFERENCE(UNAME) LIKE SY-UNAME 
*" EXPORTING 
*" VALUE(DATUMS) LIKE USR01-BNAME 
*"--------------------------------------------------------------------- 
select single DATFM into wDATFM from usr01 
where BNAME = uname. 
case wDATFM. 
when 1. 
concatenate DATUME+6(2) '.' DATUME+4(2) '.' DATUME+0(4) 
into DATUMS. 
when 2. 
concatenate DATUME+4(2) '/' DATUME+6(2) '/' DATUME+0(4) 
into DATUMS. 
when 3. 
concatenate DATUME+4(2) '-' DATUME+6(2) '-' DATUME+0(4) 
into DATUMS. 
when 4. 
concatenate DATUME+0(4) '.' DATUME+4(2) '.' DATUME+6(2) 
into DATUMS. 
when 5. 
concatenate DATUME+0(4) '/' DATUME+4(2) '/' DATUME+6(2) 
into DATUMS. 
when 6. 
concatenate DATUME+0(4) '-' DATUME+4(2) '-' DATUME+6(2) 
into DATUMS. 
endcase. 
ENDFUNCTION. 

		
This was first published in January 2002

Dig deeper on SAP HR management

Pro+

Features

Enjoy the benefits of Pro+ membership, learn more and join.

0 comments

Oldest 

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

-ADS BY GOOGLE

SearchManufacturingERP

SearchOracle

SearchDataManagement

SearchAWS

SearchBusinessAnalytics

SearchCRM

SearchContentManagement

SearchFinancialApplications

Close