SAP Factory Calendar allows companies to key in their own factory work days. Individual SAP application such as MRP will take into consideration these individual factory customizing.
For alternate Saturday, you set Saturday as a normal working day and key in all the off-days in the Special rules button.
In your abap program, you can calculate whether a particular day is a non-working day, with reference to the Factory Calendar.
ABAP Program to check for holidays using the factory calendar
* include zday .
* substitute tdate = 'yyyymmdd'.
* tholiday_found = 'X' -> Holiday
DATA: BEGIN OF INT_THOCS OCCURS 100,
THOCS LIKE THOCS.
DATA: END OF INT_THOCS.
TDATE LIKE SY-DATUM,
CALL FUNCTION 'HOLIDAY_CHECK_AND_GET_INFO'
DATE = TDATE
HOLIDAY_CALENDAR_ID = 'XX'
* WITH_HOLIDAY_ATTRIBUTES = ' '
HOLIDAY_FOUND = THOLIDAY_FOUND
HOLIDAY_ATTRIBUTES = INT_THOCS
CALENDAR_BUFFER_NOT_LOADABLE = 1
DATE_AFTER_RANGE = 2
DATE_BEFORE_RANGE = 3
DATE_INVALID = 4
HOLIDAY_CALENDAR_ID_MISSING = 5
HOLIDAY_CALENDAR_NOT_FOUND = 6
OTHERS = 7.
CALL FUNCTION 'DATE_COMPUTE_DAY'
DATE = TDATE
DAY = TDAY
OTHERS = 1.
* For checking.
*if tholiday_found = 'X'.
* write: /1 'Holiday ', tdate.
* write: /1 'Not Holiday ', tdate.
* when 0. write: /1 tdate, tday.
* when others. write: /1 'Unknown day ', tdate.
Back to Previous
Return to SAP Hints and Tips on Configuration and ABAP/4 Programming