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

Time calculation

Former Member
0 Likes
488

Hi,

I have to do time calculations in the internal table. I am having 4 fields in my table such as time1,time2,time1_mer and time2_med.In this the values will be stored like this,

time1->09:50:48

time2->06:04:52

time1_mer->AM

time2_mer->PM.

In this initially i have to do timedifference between time1 and time2. i used ISH_TIME_DIFFERENCE pattern. By this, i am having confusion in giving input in date1 and date2 fields. i am having s_date in the selection screen.what data i have to pass in the date1 and date2 fields in this pattern. could any one plz tell me how to use this pattern.

1 REPLY 1
Read only

Former Member
0 Likes
433

Hello

Try this logic:


DATA: BTIME1 TYPE TIMS, ETIME TYPE TIMS.
CALL FUNCTION 'HRVE_CONVERT_TIME'
     EXPORTING
          TYPE_TIME   = 'B'
          INPUT_TIME  = time1
          INPUT_AM_PM = time1_mer
     IMPORTING
          OUTPUT_TIME = BTIME.
* After this you will have in BTIME time in military format (13:00:00 instead of 01:00:00 PM)
CALL FUNCTION 'HRVE_CONVERT_TIME'
     EXPORTING
          TYPE_TIME   = 'B'
          INPUT_TIME  = time2
          INPUT_AM_PM = time2_mer
     IMPORTING
          OUTPUT_TIME = ETIME.
* After this you will have in ETIME time in military format (13:00:00 instead of 01:00:00 PM)

Here call ISH_TIME_DIFFERENCE with TIME1 = BTIME and TIME2 = ETIME
and you will have result.