2009 Feb 19 9:19 AM
Dear Gurus,
I have two date fields from_date and to_date .I have to time fields from_time and to_time.I need to calculate the difference in hours between (from_date,from time ) and (To_date,to_time) in hours.
I have used various function modules to get the difference.i used GET_DELTA_TIME_FROM_DT it worked but it will convert the output to zero if the hours exceeds 240000 hrs.
Could you Please help to get my requirement.As this stopping my work
2009 Feb 19 12:47 PM
Thanks,The threads helped to solve my requirement.But unfortunately the requirement has changed slightly by changed.Now they days and hours format.
ex : 5 days 15 hrs 16mins 2 secs
Please Help me.This needs to be finished my tomorrow.
Thanks,The threads helped to solve my requirement.But unfortunately the requirement has changed slightly by changed.Now they days and hours format.
ex : 5 days 15 hrs 16mins 2 secs
Please Help me.This needs to be finished my tomorrow.
2009 Feb 19 9:22 AM
SD_CALC_DURATION_FROM_DATETIME: Find the difference between two date/time and report the difference in hours
Check whether this cud help you.
2009 Feb 19 9:24 AM
Use FM SD_DATETIME_DIFFERENCE u2013 Difference in days and time for two dates
2009 Feb 19 9:27 AM
2009 Feb 19 9:31 AM
Hi,
Test the following Sample Code hope will solve out your problem,
data: t1 TYPE t,
t2 TYPE t,
def TYPE p.
t1 = '080808'.
t2 = '090909'.
BREAK-POINT.
CALL FUNCTION 'SD_DATETIME_DIFFERENCE'
EXPORTING
date1 = '20090101'
time1 = t1
date2 = '20090101'
time2 = t2
IMPORTING
* DATEDIFF =
TIMEDIFF = def
* EARLIEST =
EXCEPTIONS
INVALID_DATETIME = 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: / t1, / t2, / def.Kind Regards,
Faisal
2009 Feb 19 9:34 AM
Hi,
try these function modules
SD_CALC_DURATION_FROM_DATETIME
SD_DATETIME_DIFFERENCE
Regards,
Jyothi CH.
2009 Feb 19 9:34 AM
2009 Feb 19 12:47 PM
Thanks,The threads helped to solve my requirement.But unfortunately the requirement has changed slightly by changed.Now they days and hours format.
ex : 5 days 15 hrs 16mins 2 secs
Please Help me.This needs to be finished my tomorrow.
2009 Feb 19 12:59 PM
2009 Feb 19 2:35 PM
Check this:
DATA: from_date TYPE d,
to_date TYPE d,
diff_date TYPE p DECIMALS 2,
from_time TYPE t,
to_time TYPE t,
diff_time TYPE p DECIMALS 2.
from_date = sy-datum - 5.
to_date = sy-datum.
from_time = 120000.
to_time = 115555.
CALL FUNCTION '/SDF/CMO_DATETIME_DIFFERENCE'
EXPORTING
date1 = from_date
time1 = from_time
date2 = to_date
time2 = to_time
IMPORTING
datediff = diff_date
timediff = diff_time.
WRITE: diff_date, diff_time.
2009 Feb 20 7:33 AM
Hi Friends,
Your suggestions and recomendations has helped me solve my requirement. Thank you all for your support.
.
| User | Count |
|---|---|
| 6 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |