Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

date format

Former Member
0 Likes
480

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

2 REPLIES 2
Read only

Former Member
0 Likes
434

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.

Read only

rahulkavuri
Active Contributor
0 Likes
434

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.