Application Development 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: 

How to find difference btw time?

former_member181959
Contributor
0 Kudos

hi,

Can any one tell me are there any function modules to perform add, diff(minus) operation on time fields?

please let me know if you know any.

thanks in advance,

Prasad Babu.

6 REPLIES 6

suresh_datti
Active Contributor
0 Kudos

try

/SDF/CMO_TIME_DIFF_GET

~Suresh

naimesh_patel
Active Contributor
0 Kudos

Hello,

You can directly perform these operation on the time fields,

Like

data: t1 type t,

t2 type t,

diff type i.

diff = t2 - t1.

Regards,

Naimesh

Former Member
0 Kudos

Hi,

Try <b>CCU_TIMESTAMP_DIFFERENCE</b>

CALL FUNCTION 'CCU_TIMESTAMP_DIFFERENCE'         
      EXPORTING                                   
           timestamp1 = timestamp1                
           timestamp2 = timestamp2                
      IMPORTING                                   
           difference = diff                      
      EXCEPTIONS                                  
           OTHERS     = 1. 

http://sap.ittoolbox.com/groups/technical-functional/sap-r3-dev/f-module-for-dates-subtraction-12437...

Check out these threads

Regards,

Santosh

Former Member
0 Kudos

hi,

Check FM CCU_TIMESTAMP_DIFFERENCE

Regards,

Sailaja.

ferry_lianto
Active Contributor
0 Kudos

Hi Prasad,

Please check this FM.

<b>TIMECALC_DIFF

SCSM_TIME_DIFF_GET

SCOV_TIME_DIFF

SRET_TIME_DIFF_GET</b>

Hope this will help.

Regards,

Ferry Lianto

former_member181962
Active Contributor
0 Kudos

Hi Prasad,

You cannot add two time fields.

However, you can add a time field and a number(seconds).

data: new_time type t,

time type t,

secs type i.

new_time = time + secs.

You can subtract two time fields.

secs = new_time - time. "the difference will always be in seconds.

regards,

ravi