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: 

Date Diff excluding sat, sun an holiday

Former Member
0 Kudos

hi,

i would appreciate if someone could help me how to get the difference between two dates but it will exlude the saturday, sunday and holiday in the calculation.

thank you very much.

donna

1 ACCEPTED SOLUTION

rahulkavuri
Active Contributor
0 Kudos

Use this FM

WEEK_GET_NR_OF_WORKDAYS

Another option is u get the number of holidays and substarct it from the date difference

CATSXT_GET_HOLIDAYS

Another helpful forum

https://www.sdn.sap.com/irj/sdn/docs?rid=/webcontent/uuid/6927cccd-0501-0010-4f8f-fbb5fa062365 [original link is broken]

<b>Please Award points if found helpful</b>

6 REPLIES 6

suresh_datti
Active Contributor
0 Kudos

Hi Donna,

Put the dates in a temp table. Open the loop & for each date check if it is a workday using the function call DATE_CHECK_WORKINGDAY. Increment a counter for total no of working days.

Regards,

Suresh Datti

Former Member
0 Kudos

hii

This should help

<b>HOLIDAY_GET</b>

DATE_CHECK_WORKINGDAY

HRWPC_PCR_CHECK_WORKINGDAYS

<b>WEEK_GET_NR_OF_WORKDAYS</b>

<b>WLB3_GET_NUMBER_OF_WORKDAYS</b>

call function 'RKE_SELECT_FACTDAYS_FOR_PERIOD'

exporting

i_datab = p_start

i_datbi = p_end

i_factid = 'P8' " Factory id

tables

eth_dats = idays

exceptions

date_conversion_error = 1

others = 2.

describe table idays lines workingdays.

Reagrds

Naresh

rahulkavuri
Active Contributor
0 Kudos

Use this FM

WEEK_GET_NR_OF_WORKDAYS

Another option is u get the number of holidays and substarct it from the date difference

CATSXT_GET_HOLIDAYS

Another helpful forum

https://www.sdn.sap.com/irj/sdn/docs?rid=/webcontent/uuid/6927cccd-0501-0010-4f8f-fbb5fa062365 [original link is broken]

<b>Please Award points if found helpful</b>

Former Member
0 Kudos

The following code adds n number of WORKING days to a particular date, any days which are not

workings days (i.e. Saturday) will be ignored. For example if your starting date is Friday, adding 3 days

would return a result of Wednesday or if starting date was Wednesday resultant day would be Monday as

Saturday and Sunday are non working days. If you want to add n number of working days but allow result

to be a non working day then click here for alternative code.

See this code sample

http://www.sapdevelopment.co.uk/tips/date/date_factorydat.htm

http://www.sapdevelopment.co.uk/tips/date/date_daysadd.htm

Hope ur problem got solved, reward poinst and close the thraed if it solved.

Message was edited by: Judith Jessie Selvi

Former Member
0 Kudos

1. All u need is the factory calender code. You need to check that in SPRO.

2. Once you have that code ,use function module DATE_CONVERT_TO_FACTORYDATE

to convert start_date and end_date to factory calender days.

3. No of days = factory_start_date - factory_end_date

rahulkavuri
Active Contributor
0 Kudos

hi sorry that was a wrong ref URL, check the above one