12-28-2007 8:42 AM
Hi all
how can i find the time difference?
example 12:00:30 and 12:10:45
Any fm can do that ?
thkx
12-28-2007 8:47 AM
12-28-2007 8:54 AM
Hi Gary,
Check this Example...
DATA : TIME_1 TYPE SY-UZEIT.
DATA : TIME_2 TYPE SY-UZEIT.
DATA : OUT_PUT TYPE SY-UZEIT.
TIME_1 = '120030'.
TIME_2 = '121045'.
OUT_PUT = TIME_2 - TIME_1.
WRITE 😕 OUT_PUT.
12-28-2007 8:54 AM
Hi,
use the below FM.
CCU_TIMESTAMP_DIFFERENCE
HR_PDC_CALCULATE_TIME_DIFF
Thanks,
Sreeram.
12-28-2007 9:00 AM
hi gary,
Just have a look at this code...(execute).
data : p_stdat LIKE LTAK-BDATU,
p_endat LIKE LTAK-BDATU,
p_sttime LIKE LTAK-BZEIT,
p_endtime LIKE LTAK-BZEIT,
DELTA_TIME LIKE MCWMIT-BE_AE,
DELTA_UNIT LIKE MCWMIT-LZEIT.
DATA: P_DIFFTIME LIKE SY-UZEIT.
p_stdat = sy-datum.
p_endat = sy-datum.
p_sttime = '123000'.
p_endtime = '131000'.
P_DIFFTIME = P_ENDTIME - P_STTIME .
WRITE:/ P_DIFFTIME.
CALL FUNCTION 'L_MC_TIME_DIFFERENCE'
EXPORTING
date_from = p_stdat
date_to = p_endat
TIME_FROM = p_sttime
TIME_TO = p_endtime
IMPORTING
DELTA_TIME = DELTA_TIME
DELTA_UNIT = DELTA_UNIT
EXCEPTIONS
FROM_GREATER_TO = 1
OTHERS = 2
.
IF sy-subrc 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
WRITE:/ DELTA_TIME,
DELTA_UNIT.[/code]
U can go for the Fm cause if its a date change between the intervals ..
Reward if useful.
Thank you,
Regards.
12-28-2007 9:15 AM
Is your fm correct? 'L_MC_TIME_DIFFERENCE'
I cant refer this function module
12-28-2007 9:03 AM
Hai,
Try the following:
CALL FUNCTION 'TIMECALC_DIFF'
EXPORTING
timestamp1 = v_timestamp1
timestamp2 = v_timestamp2
timezone = sy-zonlo
IMPORTING
difference = time_diff.
time_diff = ABS( time_diff ).
12-28-2007 9:20 AM
What is your data type for time_diff, v_timestamp1
,v_timestamp2?
thks