Zed FrameOpen workbench

RP_CALC_DATE_IN_INTERVAL — ABAP Function Module

Add or subtract a bounded days/months/years interval from a date.

RP_CALC_DATE_IN_INTERVAL

Add or subtract a bounded days/months/years interval from a date.

Parameters
NameDirectionTypeDescription
DATE (required)EXPORTINGDStart date in YYYYMMDD format
DAYSEXPORTINGINumber of days
MONTHSEXPORTINGINumber of months
YEARSEXPORTINGINumber of years
SIGNUMEXPORTINGCPlus or minus sign
CALC_DATEIMPORTINGDCalculated date
DATA due_date TYPE d.
CALL FUNCTION 'RP_CALC_DATE_IN_INTERVAL'
  EXPORTING date = '20260131'
            days = 0
            months = 1
            years = 0
            signum = '+'
  IMPORTING calc_date = due_date.
WRITE: / due_date.

Example output:

20260228

Month/year shifts clamp to the last day of the resulting month. Each interval is bounded; SAP payroll calendar rules are not implemented.

Exceptions: DATE_NO_PLAUSIBLE, INTERVAL_OUT_OF_RANGE