‎2008 Mar 03 3:16 PM
hi
in SU01 i will kept date format either yyyy.mm.dd or dd.mm.yyyy
in the program at runtime i need to know in which format
the date is.
can any body help me.
regards
prathap
‎2008 Mar 03 5:40 PM
In your program it should be yyyy.mm.dd. When you perform a SY-DATUM assignment to a program variable, the system returns a date in the yyyy.mm.dd format. You should work with this format until the end, until you do an output. All system date functions work on and expect yyyy.mm.dd.
‎2008 Mar 03 5:56 PM
SLS_MISC_GET_USER_DATE_FORMAT
Use the above FM
or use the below code to get it
DATA: w_datfm TYPE xudatfm,
w_value TYPE domvalue_l,
wa_dd07v LIKE dd07v,
w_rc LIKE sy-subrc.
CONSTANTS: c_langu TYPE langu VALUE 'EN',
c_domname TYPE domname VALUE 'XUDATFM'.
If no user specified, get date format from current user's profile
CLEAR w_datfm.
IF user_name IS INITIAL.
SELECT SINGLE DATFM
INTO w_datfm
FROM USR01
WHERE BNAME = SY-UNAME.
ELSE.
SELECT SINGLE DATFM
INTO w_datfm
FROM USR01
WHERE BNAME = user_name.
ENDIF.
IF w_datfm IS INITIAL.
w_datfm = '2'. "MM/DD/YYYY
ENDIF.
w_value = w_datfm.
CALL FUNCTION 'DD_DOMVALUE_TEXT_GET'
EXPORTING
DOMNAME = c_domname
VALUE = w_value
LANGU = c_langu
IMPORTING
DD07V_WA = wa_dd07v
RC = w_rc.
IF w_rc = 0.
date_format = wa_dd07v-ddtext.
ELSE.
date_format = 'MM/DD/YYYY'.
ENDIF.