THIS PAGE HAS MOVED Add n number of working days to date
Latest info can be found at
Add n number of working days to date information can now be found at the new URL Feel free to continue to view your SAP related data at the current site ( but please aware that slight modifications may have been made to improve this information over on as well as new and related content being added!

Open all | Close all

Add n number of working days to date

The following ABAP 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 ABAP code.

Simply add the below FORM into you code and call it using the usual PERFORM command:
	  PERFORM add_working_days USING ld_numdays
        	                   CHANGING gd_date.

*&      Form  ADD_WORKING_DAYS
*       Add n number of factory days(working days) to date
*      <-- P_DAYS     Number of days to add
*      <-- P_PAYDATE  Starting date
FORM add_working_days USING p_days
                      CHANGING p_paydate TYPE sy-datum.
  DATA: gd_factorydat LIKE scal-facdate,
        gd_resdate    LIKE sy-datum.

* Convert date to factory date
            date                = p_paydate  "Starting date
            factory_calendar_id = 'GB'
            factorydate         = gd_factorydat. "Factory calender date

* Add n number of days to factory date, ignors non working days
  gd_factorydat =  gd_factorydat + p_days.

* Convert factory date back to actual date
            factorydate         = gd_factorydat
            factory_calendar_id = 'GB'
            date                = gd_resdate. "Actual date

  p_paydate = gd_resdate.
ENDFORM.                    " ADD_WORKING_DAYS