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: 

Collect statment on time feilds

bhargava_dns
Participant
0 Kudos
169

Hi ,

Is it possible to use collect statment to sum the fields of the time.

I have a requirement where i am using the collect statement on the time fields whis is not summing up the value.

if collect does not do it can please suggest some alternative instead of loop.

2 REPLIES 2

matt
Active Contributor
78

It seems an odd requirement. Why would you want to add five past one to a quarter to seven? I guess you're perhaps wanting to sum elapsed time?

In that case add a field to your internal table and fill it with the time converted to seconds. Use collect to sum up the seconds. Convert the seconds later to dd:hh:mm:ss.

if collect does not do it can please suggest some alternative instead of loop. This is a bit odd as well, since collect requires a loop. You could use a table comprehension like VALUE #( FOR wa IN itab... I suppose.

Sandra_Rossi
Active Contributor
78

COLLECT sums only variables of type numeric. The type T is not numeric, it's character-like. But if you transfer it to a numeric variable, there's an implicit conversion into a number of seconds.