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

sy-datum

Former Member
0 Likes
7,223

Hi,

datum format is always 'AAAAMMJJ' can i change it according to default date format of user (user profile ---> own data)?

Thanks

Hi,

datum format is always 'AAAAMMJJ' can i change it according to default date format of user (user profile ---> own data)?

Thanks

14 REPLIES 14
Read only

MarcinPciak
Active Contributor
0 Likes
2,152

No, internal date format is not changeable.

M.

Read only

0 Likes
2,152

If i know the date format of user, i can change it in program

Read only

0 Likes
2,152

OK Saurabh Siwach yes it's zprogram

give me the code or the MF for get the date format of user

Thanks

Read only

0 Likes
2,152

In your zprogram use FM: CONVERT_DATE_TO_EXTERNAL to convert internally stored date to user specific date (as appears in su01).

Remeber it is up to you how you process the date, but SAP internally will never accept different format than YYYYMMDD.

Read only

0 Likes
2,152

Hi simo,

You can use the function module.

DATA : DATEX TYPE CHAR10.

CALL FUNCTION 'FORMAT_DATE_4_OUTPUT'
  EXPORTING
    DATIN         = SY-DATUM
    FORMAT        = 'DD/MM/YYYY'
 IMPORTING
   DATEX         = DATEX
          .

WRITE / DATEX.

CALL FUNCTION 'FORMAT_DATE_4_OUTPUT'
  EXPORTING
    DATIN         = SY-DATUM
    FORMAT        = 'MM/DD/YYYY'
 IMPORTING
   DATEX         = DATEX
          .

WRITE / DATEX.

Regards

Read only

0 Likes
2,152

constants : c_d1 TYPE xudatfm VALUE '1',

c_d2 TYPE xudatfm VALUE '2',

c_d3 TYPE xudatfm VALUE '3',

c_d4 TYPE xudatfm VALUE '4',

c_d5 TYPE xudatfm VALUE '5',

c_d6 TYPE xudatfm VALUE '6',

c_dot value '.',

c_hyp value '-',

c_sl value '/'.

DATA : wg_usr01 TYPE usr01,

g_date(10).

SELECT SINGLE * FROM usr01

INTO wg_usr01

WHERE bname EQ sy-uname.

IF wg_usr01-datfm EQ c_d1.

g_date0(2) = g_deldate8(2).

g_date+2(1) = c_dot.

g_date3(2) = g_deldate5(2).

g_date+5(1) = c_dot.

g_date6(4) = g_deldate0(4).

ELSEIF wg_usr01-datfm EQ c_d2.

g_date0(2) = g_deldate5(2).

g_date+2(1) = c_sl.

g_date3(2) = g_deldate8(2).

g_date+5(1) = c_sl.

g_date6(4) = g_deldate0(4).

ELSEIF wg_usr01-datfm EQ c_d3.

g_date0(2) = g_deldate5(2).

g_date+2(1) = c_hy.

g_date3(2) = g_deldate8(2).

g_date+5(1) = c_hy.

g_date6(4) = g_deldate0(4).

ELSEIF wg_usr01-datfm EQ c_d4.

g_date0(4) = g_deldate0(4).

g_date+4(1) = c_dot.

g_date5(2) = g_deldate5(2).

g_date+7(1) = c_dot.

g_date8(2) = g_deldate8(2).

ELSEIF wg_usr01-datfm EQ c_d5.

g_date0(4) = g_deldate0(4).

g_date+4(1) = c_sl.

g_date5(2) = g_deldate5(2).

g_date+7(1) = c_sl.

g_date8(2) = g_deldate8(2).

ELSEIF wg_usr01-datfm EQ c_d6.

g_date = g_deldate.

ENDIF.

Read only

Former Member
0 Likes
2,152

Hi,,,,,,

This is the standard date format set by SAP 'AAAAMMJJ',,,

you can not change it..........

yes in your zreport you can do wat ever you want with your date...... means you can display in any form at you want........

if you want code for that ..... do let me know....

Thanks

Saurabh

Read only

Former Member
0 Likes
2,152

Hi,,,,,,

Yes you can change it in your ZREPORT.....

no issues in that.....

Thanks

Saurabh

Read only

Former Member
0 Likes
2,152

Hi.....

Code for that is....


data: year(4),
         month(2),
         day(2),
         date(10),
        seperator type c value '/'.

year = sy-datum+0(4).
month = sy-datum+4(2).
day = sy-datum+6(2).

concatenate day month year into date seperated by seperator.

write:/ date.

The out put of above code will be


write:/ date.
ans - 7/11/2008.

Thanks

Saurabh

Read only

Former Member
0 Likes
2,152

Hi,

Thisuser information is stored in table USR01.

data: xusr01 type usr01.
select * into xusr01 from usr01
          where bname = sy-uname.

Check field DATFM. Possible values are...

1	DD.MM.YYYY
2	MM/DD/YYYY
3	MM-DD-YYYY
4	YYYY.MM.DD
5	YYYY/MM/DD
6	YYYY-MM-DD

REgards,

Nandha

Read only

Former Member
0 Likes
2,152

hi Friend,

i check this function module FORMAT_DATE_4_OUTPUT

but the result display not found.

Function module FORMAT_DATE_4_OUTPUT is there are not?

I checked in both IDES and DEV Server.

Plz refer & tell

Regards,

K.S.Kannan

Read only

0 Likes
2,152

As I told you use this one instead, it works fine:


data: date_int type d VALUE '20081107',
      date_ext(10) type c.

CALL FUNCTION 'CONVERT_DATE_TO_EXTERNAL'
          EXPORTING
            date_internal            = date_int
          IMPORTING
            date_external            = date_ext
          EXCEPTIONS
            date_internal_is_invalid = 1
            OTHERS                   = 2.
write date_ext.

Regards

M.

Read only

Former Member
0 Likes
2,152

Hi SIMO,,,

Is Problem solved or not..................

Do let me Know......

Thanks

Saurabh

Read only

0 Likes
2,152

Ohhhh Thanks experts for all your responses...it's very interesting

I think the FM ''CONVERT_DATE_TO_EXTERNAL'' it's the solution for me....i'll be testing