09-25-2009 11:56 AM
Dear SDN-Community,
I am looking for a possibility to convert time into time using user's time format customizing of database table usr11.
There is a field TIMEFM in which this setting is stored. The following variants are possible:
0 24 Hour Format (Example: 12:05:10)
1 12 Hour Format (Example: 12:05:10 PM)
2 12 Hour Format (Example: 12:05:10 pm)
3 Hours from 0 to 11 (Example: 00:05:10 PM)
4 Hours from 0 to 11 (Example: 00:05:10 pm)
Do anybody know a function module for this conversion purpose?
Thanks in advanced and best regards,
Thomas
09-25-2009 12:25 PM
Hi Thomas Ploski ,
Take a charachter field of length 10 and use below sytax. You can achieve time in user format.
example.
w_time = 072222.
Write w_time to w_char.
w_time = 072222.
w_char = 07:22:22.
Venkat.
09-25-2009 12:27 PM
Hi Venkat,
Thanks for your reply, but I need s solution in which the time format using usr11 table is considered.
Best regards,
Thomas
09-25-2009 12:31 PM
Hello Thomas,
I think that if you define the variable like SY-UZEIT then when you display it, the output will be in user format by default.
BR,
Suhas
09-25-2009 12:43 PM
Hi Suhas,
I have tested my coding with defining data type sy-uzeit. But there is no conversion
Best regards,
Thomas
09-25-2009 1:54 PM
Hello Thomas,
I dont find this field TIMEFM in the table USR11. Can you please elaborate?
BR,
Suhas
09-25-2009 2:07 PM
I'm sorry, i was my fault - the corresponding table is USR01.
Best regards,
Thomas
09-25-2009 2:21 PM
09-25-2009 2:23 PM
There is a field named TIMEFM for the time format in this mentioned database table.
09-25-2009 2:37 PM
Hi Thomas Ploski,
Not exact but based on the value of USR01-TIMEFM table entries you can differeciate logic and for value 1 & 2 ( means 12 hours) you can use below FM to convert time from 24 hours to 12 hours format...
HRVE_CONVERT_TIME
Import parameters Value
TYPE_TIME A
INPUT_TIME 18:34:00
INPUT_AM_PM AM
Export parameters Value
OUTPUT_TIME 06:34:00
OUTPUT_AM_PM PM
Hope it will solve your problem..
Thanks & Regards
ilesh 24x7
ilesh Nandaniya
09-25-2009 4:42 PM
Hi Thomas,
see SAP help for SET:
Example
When outputting documents, display the decimal point and date in the format specified for the country of the recipient:
DATA: RECEIVER_COUNTRY LIKE T005X-LAND,
DATE LIKE SY-DATUM,
AMOUNT TYPE P DECIMALS 2.
...
SET COUNTRY RECEIVER_COUNTRY.
IF SY-SUBRC = 4.
WRITE: / RECEIVER COUNTRY, ' is unknown'.
ENDIF.
WRITE: / DATE, AMOUNT.
Then, you can say
SET COUNTRY SPACE.
to display the decimal point and date according to the specification for the user again.
Regards,
Clemens
09-25-2009 5:08 PM
Hi Thomas, take a look at 'convert time stamp lv_timestamp time zone lv_tz into date lv_date'. Where lv_timestamp type timestamp, lv_tz type ttzz-zone and lv_date type d.
Kevin