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 to add 2 time fields

Former Member
0 Likes
1,775

I've 2 time fields : t1 = 06:00:00 (start time)

t2 = 06:00:00 (end time)

t3 = 01:30:00 (break time)

it's basically : t1 + t2 - t3.

the result should be : 21:30:00

6 REPLIES 6
Read only

rainer_hbenthal
Active Contributor
0 Likes
1,235

Convert everything to minutes, claculate the duration and convert it back to hours and minutes.

Read only

Former Member
0 Likes
1,235

Hi Narsingh,

You can try this fm L_MC_TIME_DIFFERENCE.

Regards,

Arun.

Read only

1,235

It's not working Arun. I basically want to add times.

Read only

Himayatullah
Active Participant
0 Likes
1,235

Hi Narsingh,

Do like this :

tables : syst .

parameters : time1 like syst-uzeit ,

time2 like syst-uzeit .

data : time3 TYPE STRING ,time4 TYPE STRING,time5 TYPE STRING.

time4 = time1 .

time5 = time2 .

time3 = time4 + time5 .

write /(10) time3 USING EDIT MASK'__:__:__'

or converting the time in seconds, and then adding all the time in seconds and then converting it back to hrs and mins as required....

best regards

Himayat

Read only

Former Member
0 Likes
1,235

I've 2 time fields : t1 = 06:00:00 (start time)

t2 = 06:00:00 (end time)

t3 = 01:30:00 (break time)

it's basically : t1 + t2 - t3.

the result should be : 22:30:00

Read only

Former Member
0 Likes
1,235

Moderator message - You changed your formula after a number of responses and I doubt if anyone will notice the change - post locked And I don't see how you get either answer given the times you are using. Please explain more fully before re-posting. Rob