08-01-2008 7:45 AM
Hi
I need to subtract two time fields...
how to do that....
Cheers
Christina
08-01-2008 7:47 AM
hiii
use FM L_MC_TIME_DIFFERENCE
take both field's value in variables and subtract
w_time = w_time1 - w_time2.
w_time will give you final time value.
regards
twinkal
08-01-2008 7:47 AM
hiii
use FM L_MC_TIME_DIFFERENCE
take both field's value in variables and subtract
w_time = w_time1 - w_time2.
w_time will give you final time value.
regards
twinkal
08-01-2008 7:49 AM
hi,
put the dates in two variables and do the normal subtraction
data : a type sy-uzeit ,
b type sy-uzeit.
a = sy-uzeit.
b = sy-uzeit + 1.
a = b - a.
write a.
regards
prasanth
08-01-2008 7:50 AM
Use below logic.
Data: t1 type sy-uzeit,
t2 type sy-uzeit,
td type sy-uzeit.
td = t1 - t2.
Regards,
08-01-2008 7:51 AM
08-01-2008 7:53 AM
08-01-2008 8:06 AM
Hi,
Use the Function Module 'SALP_SM_CALC_TIME_DIFFERENCE'.
date format = 01/08/2008
time format = 01:30:20
CALL FUNCTION 'SALP_SM_CALC_TIME_DIFFERENCE'
EXPORTING
DATE_1 = '01082008'
TIME_1 = '013020'
DATE_2 = '01082008'
TIME_2 = '003010'
IMPORTING
SECONDS = SECONDS
.
WRITE seconds.
It will give the diffrence in the form of seconds (ss).
But if you want that in the format of mm:ss use edit mask concept.
DATA: time TYPE s_fltime,
msk TYPE string.
DESCRIBE FIELD time EDIT MASK msk.
CALL FUNCTION 'SALP_SM_CALC_TIME_DIFFERENCE'
EXPORTING
DATE_1 = '01082008'
TIME_1 = '013020'
DATE_2 = '01082008'
TIME_2 = '013010'
IMPORTING
SECONDS = SECONDS
.
WRITE seconds USING EDIT MASK msk.
Hope this will help.
Regards,
Swarna Munukoti
08-01-2008 8:36 AM
HI ,
Give output in hours as well as seconds .
CALL FUNCTION '/SDF/CMO_TIME_DIFF_GET'
EXPORTING
utc_start = w_usrformat1(YYYYMMDDHHMMSS)
utc_end = w_usrformat2
IMPORTING
second = w_seconds
hours = w_hours
EXCEPTIONS
paramerr = 1
OTHERS = 2.
IF sy-subrc NE 0.
* Do Nothing
ELSE.