Application Development Blog Posts
Learn and share on deeper, cross technology development topics such as integration and connectivity, automation, cloud extensibility, developing at scale, and security.
cancel
Showing results for 
Search instead for 
Did you mean: 
Joerg_S
Participant

I was searching for a function module that should calculate the duration of 2 tasks .

Import Parameter:

DATE_FROM

DATE_TO

TIME_FROM

TIME_TO

As result I need values separated into

YEARS

MONTHS

DAYS

HOURS

MINUTES

SECONDS

Most standard function deliver only one(1) result and than this return value is from type F (floating number, like 2,34546787E-03) and I did not want to convert the result into integer. Other standard functions look like they could work, but when I checked them I found that they where calculation wrong!

So I came to the conclusion to copy+paste what ever I can and I wrote my own function module using the SAP function module 'L_TO_TIME_DIFF' 

Here it is (check attachment)

Please comment if you find a BUG, I will try to solve it.


Germany, 16.01.2016

Jörg Sauterleute

----

UPDATE, 17.01.2016

I found and error and replaced attachment/coding...


UPDATE, 22.01.2016

another bug found (seconds where wrong when time_to < time_from)

UPDATE, 28.01.2016

next bug with time (seconds where wrong, when date_to = date_from AND time_to < time_from) 😛

2 Comments
Labels in this area