cancel
Showing results for 
Search instead for 
Did you mean: 

WORKDAYS_BETWEEN function

patrickbachmann
Active Contributor
0 Kudos

Hi folks,

I'm looking for a way to calculate workdays between two dates and I don't want to include holidays (I want holidays to be considered normal days).  I noticed in our new SPS8 HANA we have this new function for WORKDAYS_BETWEEN which works great as I've tested but the problem is we dont seem to have a factory calendar setup that has zero holidays in it.  So obviously we could easily create a new factory calendar but i wasn't sure if that's the best thing to do in this case because we'd always have to maintain it OR perhaps somebody has a code snippet that works equally as well to just exclude weekends between two dates. 

Thanks,

-Patrick

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Patrick,

First WORKDAYS_BETWEEN appeared in SAP HANA SQL Reference first time which means in SPS07 WORKDAYS_BETWEEN is already supported. You can find the function here WORKDAYS_BETWEEN - SAP HANA SQL and System Views Reference - SAP Library There is a note:


"In order to use the WORKDAYS_BETWEEN function a factory calendar table TFACS must be available in the SAP HANA database. In SAP BW, SAP CRM, and SAP ERP systems running on a SAP HANA database the table TFACS is located in the ABAP schema SAP<SID>. For other SAP HANA databases the TFACS table can be replicated from a SAP Business Suite system."

Best regards,

Wenjun

patrickbachmann
Active Contributor
0 Kudos

Hi Wenjun,

Thank you for your response.  I have been out of the office for a few days and just getting back to this.  Actually I have this function working correctly and I do indeed have TFACS replicated and everything works except we have no calendars setup in SAP that have zero holidays entered.  So as a workaround we are setting up a new calendar with only weekends as non-working days.  This question was really more about whether anybody has created a formula without using TFACS and without using WORKDAYS_BETWEEN function at all.  ie: an alternative to using this functionality.

Many thanks!

-Patrick

patrickbachmann
Active Contributor
0 Kudos

FYI:  I just created a new calendar with no holidays.

Answers (0)