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 Sum

jogeswararao_kavala
Active Contributor
0 Likes
1,412

Dear Experts,

I am working on duration field (difference between two time fields). I could get the values in a field successfully as HH.MM.

(Field Type used is DEC 10.2)

Now I need the total of this column not as decimal system, but as time system.

How can I ahieve this?

I have been working and searching for solution since quite sum time.

Can some one help.

Regards

Jogeswara Rao

7 REPLIES 7
Read only

kesavadas_thekkillath
Active Contributor
0 Likes
1,025

Considering

I have been working and searching for solution since quite sum time.

I would like to help you

Declaring the type as tims (timestamp) will solve it as in function C14B_ADD_TIME.

Kesav

Read only

0 Likes
1,025

Thank you Keshav for the valuable clue.

I'll work on it.

kind regards

Jogeswara Rao

Read only

former_member186055
Active Participant
0 Likes
1,025

Hi Jogeswara Rao,

Please check the below code, it may work...

DATA:
  lv_time   TYPE dec10_2 VALUE '23.23',
  lv_time_c TYPE char9,
  gv_time   TYPE tims.

lv_time_c = lv_time.

SHIFT lv_time_c LEFT DELETING LEADING space.

CONCATENATE lv_time_c '.00' INTO lv_time_c.
REPLACE ALL OCCURRENCES OF '.' IN lv_time_c WITH ''.

gv_time = lv_time_c.

WRITE:
  gv_time.

Regards,

Surya

Read only

Former Member
0 Likes
1,025

Hi Rao,

please use data type as tims. it will solve your problem.

Thanks

Read only

0 Likes
1,025

Thanks everyone.

But type TIMS can not be added. Sum is disabled for this column.

This is my requirement. i.e. To have total of this column in Hr and Min not as decimals

Regards

Jogeswara Rao

Read only

0 Likes
1,025

Hi,

Now i understood your question. Here is your solution by creating a custom conversion exit.

[Sum of times (HHMMSS) in ALV Grid !!!|http://sap.ittoolbox.com/groups/technical-functional/sap-abap/help-sum-of-times-hhmmss-in-alv-grid-3347395]

Read only

0 Likes
1,025

Thanks Keshav,

That is the only resource available in the net on this topic. I'd spent enough time on that by creating identical Function, only to find the sum is not in Hr.Mt. It is calculating Decimal wise only (Because the type is DEC 10_2). I doubt, the author did not confirm this before posting that thread in ITTOOLBOX.

Regards

Jogeswara Rao