Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Function module for calculating the time difference

Former Member
0 Likes
20,064

I want to calculate the difference ( in hours ) between two given times.

Is there any function module for this .

Thanks in advance.

6 REPLIES 6
Read only

Former Member
0 Likes
8,101

'HR_TIME_AND_DURATION'

Read only

Former Member
0 Likes
8,101

HI,

check for the function module

/SDF/CMO_TIME_DIFF_GET

reward points if helpful

regards,

venkatesh

Read only

Former Member
0 Likes
8,101

Hi,

Try the FM <b>'HR_TIME_AND_DURATION'</b>.

Try the Following Sample Code:

DATA : lv_end_time TYPE uplend VALUE '140000',

lv_seconds TYPE sytabix,

lv_total_seconds TYPE sytabix,

lv_rem_seconds TYPE sytabix,

lv_temp_hours TYPE uplend.

lv_total_seconds = 5 * 60 * 60.

CALL FUNCTION 'SWI_DURATION_DETERMINE'

EXPORTING

start_date = sy-datum

end_date = sy-datum

start_time = sy-uzeit

end_time = lv_end_time

IMPORTING

duration = lv_seconds.

lv_rem_seconds = lv_total_seconds - lv_seconds.

lv_rem_seconds = lv_rem_seconds MOD 86400.

lv_temp_hours = lv_rem_seconds.

WRITE 😕 lv_temp_hours.

Regards,

Padmam.

Read only

Former Member
0 Likes
8,101

Please go through the Functions Module , it gives date as well as time difference, though U may have to enter time as well.

SD_DATETIME_DIFFERENCE

SD_CALC_DURATION_FROM_DATETIME : Find the difference between two date/time and report the difference in hours

L_MC_TIME_DIFFERENCE : Find the time difference between two date/time

Read only

Former Member
0 Likes
8,101

hi chandru,

u can also try this fm SD_DATETIME_DIFFERENCE

Regards...

Arun.

Reward points if useful.

Read only

Former Member
0 Likes
8,101

Hi,

Try the following FM

SCOV_TIME_DIFF_46B

TIMECALC_DIFF

SCSM_TIME_DIFF_GET

SCOV_TIME_DIFF

SRET_TIME_DIFF_GET

Regards