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

Working Hours Calculation possible ?

0 Likes
881

Anyone know if there is a FM to calculate the Working Hours that exist between two dates.

For instance ...entire year may = 2080 working hours. User wants to know Working hours between

any two dates .... like.... July 1, 2007 and May 5, 2008.....

Thanks

MPersson

7 REPLIES 7
Read only

Former Member
0 Likes
814

You can find the working days between two dates but unless you want to assume that someone worked for 8 hours for each work day, you cannot find the working hours. Of course, if you implemented HR and time entry in your SAP, then maybe.

Read only

0 Likes
814

Srinivas

Thank you for your response.

I dug around some more and found that I can use

FUNCTION 'HR_99S_INTERVAL_BETWEEN_DATES'

to calculate the number of weeks between dates.

I can then multiple the #of Weeks by 40 hrs.

That ends up working for me.

Thanks again.

MPersson

Read only

0 Likes
814

And if there are holidays? Or fractions of weeks??

Rob

Edited by: Rob Burbank on Sep 17, 2009 5:36 PM

Read only

0 Likes
814

Rob,

Thats a valid point. In my case I am only determining the total possible working hours for a budget report.

Prior to this, the supervisors were simply using a full year of 52 weeks x 40 hrs = 2080. This report takes

the hours captured on the CATS timesheet and processes them accordingly. So Holidays and any leave

time is identified within the program code and handled then.

Thanks

MPersson

Read only

0 Likes
814

But FM HR_99S_INTERVAL_BETWEEN_DATES gives the wrong number of weeks for fractions. If you use today's and tomorrow's dates, I think you'll find that it returns zero weeks. Is that what you want?

Try using days and multiply by eight instead.

Rob

Edited by: Rob Burbank on Sep 18, 2009 10:09 AM

Read only

0 Likes
814

Hi You can find calendar settings in country specfic settings this where you maintain holidays. Look for an FM which takes country or calendar id as input it is easy to calculate Weeks * 40 or Days * 8 for these results. It gets really easy if you HR on same box. You can take teh concept from following and build one yoru own will eb handy for future.

FIMA_DAY_CONVERT_TO_WORKINGDAY

Read only

0 Likes
814

Both of you have provided good solutions.

Looks like I'll have to code some revisions.

Thank you

MPersson