‎2009 Jul 29 1:26 PM
Hi all,
I want to convert date on user specific settings
Example i have seetings like dd/mm/yy and another user has settings mm/dd/yyyy.
If i login any client i want to convert date to yyyyddmm.
How can i do this.
Thanks
‎2009 Jul 29 1:47 PM
Hi,
DATA : L_DATE TYPE char10.
WRITE SY-DATUM to l_date. " Converts the sy-datum as per the user specific setting's and moves to l_date field
‎2009 Jul 29 1:27 PM
‎2009 Jul 29 1:43 PM
- Use BAPI_USER_GET_DETAIL, returned parameter DEFAULTS-DATFM has the date format of the user.
- Table USR01 contains the same field
- Take a look at [SET COUNTRY|http://help.sap.com/abapdocu/en/ABAPSET_COUNTRY.htm]
- you can get the date format programmaticaly like in
WRITE HIGH_DATE TO GDF_DATE DD/MM/YYYY.
CASE GDF_DATE.
WHEN '31.12.9999'. DATE_FORMAT = 1.
WHEN '12/31/9999'. DATE_FORMAT = 2.
WHEN '12-31-9999'. DATE_FORMAT = 2.
WHEN '9999.12.31'. DATE_FORMAT = 4.
WHEN '9999/12/31'. DATE_FORMAT = 4.
WHEN '9999-12-31'. DATE_FORMAT = 4.
ENDCASE.For information on WRITE date format look at [WRITE Addition 14|http://help.sap.com/abapdocu/en/ABAPWRITE_TO_OPTIONS.htm#!ABAP_ADDITION_14@14@]
Regards,
Raymond
‎2009 Jul 29 1:47 PM
Hi,
DATA : L_DATE TYPE char10.
WRITE SY-DATUM to l_date. " Converts the sy-datum as per the user specific setting's and moves to l_date field
‎2013 Jul 24 7:31 PM
‎2013 Jul 25 6:28 AM
‎2009 Jul 29 1:55 PM
hi,
goto SU01. give the user name. click change.
goto DEFAULTS tab.
there you have date format.
select the format you want. then save.
job done.
thank you.
Somu
‎2009 Jul 29 1:57 PM
Hi,
* Convert date 1/3/9999 into 99990301
CALL FUNCTION 'CONVERSION_EXIT_SDATE_INPUT'
EXPORTING
input = w_inputfile-endda
IMPORTING
output = w_inputfile-endda.
* Convert date 99990301 into 01/03/9999
CALL FUNCTION 'CONVERSION_EXIT_PDATE_OUTPUT'
EXPORTING
input = w_inputfile-endda
IMPORTING
output = w_inputfile-endda.
or try this..
Key = sy-datum.
SELECT SINGLE * FROM usr01 WHERE bname = sy-uname.
CASE usr01-datfm.
WHEN 1.
WRITE key TO formatted_date DDMMYY.
WHEN 2 OR 3.
WRITE key TO formatted_date MMDDYY.
WHEN OTHERS.
WRITE key TO formatted_date YYMMDD.
ENDCASE.
Prabhudas
‎2009 Jul 29 2:01 PM
Hi,
Get the user specific setting using below FM:
SLS_MISC_GET_USER_DATE_FORMAT
OR
Convert the date format into yyyy.mm.dd by using below FM (independent of user specific date):
SLS_MISC_CONVERT_TO_DATE
from here you can manipulate the date using concatenate.
Thanks and Regards,