07-13-2009 6:23 AM
i want two variables with data type timestamp and numc3 . the content of the first variable is 12:30:00. and the content of the second variable is 022. It is basically in minutes. when i add up the two it gives the output as 12:30:22. which is wrong . i want to convert this numeric data to timestamp. is there any function module to do that. can any one help me ?
07-13-2009 6:33 AM
Hi,
Test the bellow Sample Code it will solve out your problem,
DATA: time LIKE sy-uzeit,
min TYPE i,
sec TYPE i.
time = sy-uzeit.
min = 50. " Total Min
sec = 50 * 60. " Convert Min to Sec
ADD: sec TO time.
WRITE: time.
Best Regards,
Faisal
07-13-2009 6:42 AM
07-13-2009 6:36 AM
Hi Kallol,
Multiply numc3 with 60 (convert min to sec) before adding to timestamp.
Hope this helps!
Regards,
Saumya
07-13-2009 6:42 AM
convert ur minutes to TIME format
e.g
convert minutes to secs
seconds = 22 * 60.
Now convert to time format
add_time+0(2) = seconds / 3600. "Hours
seconds = seconds mod 3600.
add_time+2(2) = seconds / 60. "Minutes
seconds = seconds mod 60.
add_time+4(2) = seconds. "Seconds
now use FM CONV_UTIL_ADD_DATE_AND_TIME to add time to timestamp
CALL FUNCTION 'CONV_UTIL_ADD_DATE_AND_TIME'
EXPORTING
in_timestamp = cur_tm_stmp
* add_days = days
add_time = add_time
IMPORTING
out_timestamp = cur_tm_stmp.