SAP Function DATE_CONVERT_TO_FACTORYDATE - Calendar function: Returns factory calendar date for a date

Parameter Reference Type Length Default Optional Text
CORRECT_OPTION SCAL-INDICATOR C 1 '+' X Flag how workday should be calculated
DATE SCAL-DATE D 8 Date to be converted into factory calendar date
FACTORY_CALENDAR_ID SCAL-FCALID C 2 Factory calendar ID

Parameter Reference Type Length Text
DATE SCAL-DATE D 8 Date to be converted into factory calendar date
FACTORYDATE SCAL-FACDATE P 3 Number of the workday in the specified calendar
WORKINGDAY_INDICATOR SCAL-INDICATOR C 1 Flag whether date is a workday

Exception Text
CALENDAR_BUFFER_NOT_LOADABLE Factory calendar could not be buffered
CORRECT_OPTION_INVALID CORRECT_OPTION is not '+' or '-'
DATE_AFTER_RANGE Date is later than factory calendar definition
DATE_BEFORE_RANGE Date is earlier than factory calendar definition
DATE_INVALID Invalid date format
FACTORY_CALENDAR_NOT_FOUND Factory calendar is not in buffer


INCLUDE 'DOCU_HAS_TO_BE_ELABORATED' OBJECT DOKU ID TX
In the factory calendar, the working days are numbered sequentiallyfromthe first working day. The working day numbers are called thefactory date. This function module calculates the factory date for acalendar date. If the date passed is not a working day, the next orprevious working day is calculated.
Example call:
DATA: DATE1 LIKE SCAL-DATE,
DATE2 LIKE SCAL-DATE,
CORRECTION LIKE SCAL-INDICATOR,
CALENDAR LIKE SCAL-FCALID,
FACTORYDATE LIKE SCAL-FACDATE,
WORKDAY LIKE SCAL-INDICATOR.
CALL FUNCTION 'DATE_CONVERT_TO_FACTORYDATE'
EXPORTING DATE = DATE1
CORRECT_OPTION = CORRECTION
FACTORY_CALENDAR_ID = CALENDAR
IMPORTING DATE = DATE2
FACTORYDATE = FACTORYDATE
WORKINGDAY_INDICATOR = WORKDAY
EXCEPTIONS CORRECT_OPTION_INVALID = 1
DATE_AFTER_RANGE = 2
DATE_BEFORE_RANGE = 3
DATE_INVALID = 4
FACTORY_CALENDAR_NOT_FOUND = 5.
All exception are raised with RAISE.
Possible values are:
' ' the specified date is a working day.
'+' the specified date is not a working day,
the following working day is returned.
'-' the specified date is not a working day,
the previous working day is returned.
Possible values are:
'+' if the specified date is not a working day,
the first working day after the date is returned.
(default)
'-' if the specified date is not a working day,
the first working day before the date is returned.