Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

calc time difference using factory calendar between 2 dates and time

BW experts,

I need your suggestions in how to calculate number of hours between 2 dates and time according to factory calendars. Calc results should not include holiday hours and include only business days hours.

input1 - order creation date and time

input2 - shipping date and time

difference should include hours on business days..and exclude 48 hrs of weekend as well as any holidays.

Thanks,

Rita

Former Member
replied

hi,

you can use FM HOLIDAY_GET to get holidays between two provided dates and provided calender

and the you easily cal difference between two date minus holidays

also the below wiki might help you in writing coding better for holidays on weekends

http://wiki.sdn.sap.com/wiki/display/Snippets/ABAP-ToGetnoofHolidaysfallinginweekendsforaparticularfiscalperiod

to calculate the difference b/w the dates you can use FM SALP_SM_CALC_TIME_DIFFERENCE to get the difference in seconds.

then divide the result by 3600 to get output in hours

hope it helps

regards

laksh

2 View this answer in context
Not what you were looking for? View more on this topic or Ask a question