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 last published in January 2002

Dig Deeper on SAP HR management

PRO+

Content

Find more PRO+ content and other member only offers, here.

Start the conversation

Send me notifications when other members comment.

By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Please create a username to comment.

-ADS BY GOOGLE

SearchManufacturingERP

SearchOracle

SearchDataManagement

SearchAWS

SearchBusinessAnalytics

SearchCRM

SearchContentManagement

SearchFinancialApplications

Close