SAP date_after_range error

If you are using SAP functionality to check a date, for example maybe you are using the below function module to check if a date is a working day or not you may get the date_after_range error.

          date                       = ld_date
          factory_calendar_id        = 'GB'
          message_type               = 'S'
          date_after_range           = 1
          date_before_range          = 2
          date_invalid               = 3
          date_no_workingday         = 4
          factory_calendar_not_found = 5
          message_type_invalid       = 6
          OTHERS                     = 7.
      IF sy-subrc <> 0.

This type of functionality all comes back to a factory calendar such as ‘GB’ in this case so if you are receiving the date_after_range error it means that date you are checking is outside of the range set up in the SAP factory calendar definition with transaction SCAL. It would be the same if you were getting the date_before_range error.

It is also very simple to fix, simply execute t-code SCAL and change the validity of the calendar you are wanting to use so that includes the dates you want to check.

First, choose what type of calender you want
scal transaction factory calender

Then choose the one you want to update.