‎2011 Oct 03 12:39 PM
Some users would have set their preference to 12 hrs and some to 24 hrs. We would like to present on the UI (BSP or ABAP screens) the time in a time format of the user (24 hr/12 hr). How do we achieve this? Is there an inbuilt routine or statement or complex data type which would help us achieve this?
‎2011 Oct 03 12:50 PM
Hello,
This you could achieve by calling FM HRVE_CONVERT_TIME which converts 12 hrs to 24 hrs formata
and vice versa.You could place a radio button on UI for 12 hrs and 24 hrs format and based on user option,
call this FM and pass TYPE_TIME as B - for 12 hrs to 24 hrs format and A - for 24 hrs to 12 hrs.
regards
Ikshula
‎2011 Oct 03 1:19 PM
Thanks Ishkula.
But is there anyway we can read the user setting than providing a radio button in the UI?
Regards,
Krittika D Patil
‎2011 Oct 03 1:51 PM
Hi,
Yes rather than using radio button,you could also read the user setting by
reading the table USR01 by passing the user name.Based on TIMEFM field
value you can know whether user's preference is 12 hrs or 24 hrs format.
( 0 - 24 hrs format, 1- 12 hrs format ).
Thanks and regards
‎2011 Oct 03 1:36 PM
Hi,
Use SUSR_USER_DEFAULTS_GET function. Export parameter USER_DEFAULTS's field TIMEFM is what you need. Then convert if you need.
Take care,
Çağatay
‎2011 Oct 03 9:24 PM
Hi,
This "new" user's time format has been accompanied by a change of WRITE statement, described in [SAP note 1091821 (ABAP WRITE statement and 12-hour time format.)|https://service.sap.com/sap/support/notes/1091821 ] (see kernel patches)
WRITE t ENVIRONMENT TIME FORMAT [TO c].Sandra