Master the ABAP Date Calculation with ABAP Code example

Published by John on


ABAP Date Calculation gives a very quick tools to calculate new date from an other day. It allows in ABAP to Add or Sustract Years, Months or Days.

ABAP date Add/ Substrat Years

The easiest way in ABAP Date to Add Years is to use the standard function module ADD_TIME_TO_DATE.

ABAP date Add/ Substrat Months

With the use of the same function module, you can add / remove Months from an ABAP date.

The function signature is:

  • i_idate: the base SAP Date
  • i_time: the number of Year/Month/Day to be added. in Order to substract to SAP Date, just use negative i_time.
  • i_iprkz: is the Period indicator.

ABAP date Add/ Substrat?Weeks

This function module also allows to add or substract Days from an SAP date?ADD_TIME_TO_DATE.?

Just?et i_iprkz to ‘1’ ( 1 for Weeks).

ABAP date Add/ Substrat Days

ADD_TIME_TO_DATE can also add or substract Days to ABAP data.
you have just to leave i_iprkz?empty.

SAP/ABAP Date format

SAP Date format

  • DATE

    The DATE data type consists of year, month, and day information to represent a date value. The default format for the DATE data type is ‘YYYY-MM-DD’. YYYY represents the year, MM represents the month, and DD represents the day. The range of the date value is between 0001-01-01 and 9999-12-31.

  • TIME

    The TIME data type consists of hour, minute, and second to represent a time value. The default format for the TIME data type is ‘HH24:MI:SS’. HH24 represents the hour from 0 to 24, MI represents the minute from 0 to 59, SS represents the second from 0 to 59.


    The SECONDDATE data type consists of year, month, day, hour, minute and second information to represent a date with time value. The default format for the SECONDDATE data type is ‘YYYY-MM-DD HH24:MI:SS’. YYYY represents the year, MM represents the month, DD represents the day, HH24 represents hours, MI represents minutes, and SS represents seconds. The range of the date value is between 0001-01-01 00:00:01 and 9999-12-31 24:00:00.


    The TIMESTAMP data type consists of date and time information. Its default format is ‘YYYY-MM-DD HH24:MI:SS.FF7’. FFn represents the fractional seconds where n indicates the number of digits in fractional part. The range of the time stamp value is between 0001-01-01 00:00:00.0000000 and 9999-12-31 23:59:59.9999999.

Period indicator DATTP

The Period Indicator defines the type of the date number ( Year, Month or day)
The Period Indicator is set on Domain DATTP. The list of value are :

  • ‘?’ Day
  • ‘1’ Week
  • ‘2’ Month
  • ‘3’ Year

It has also two conversion routines


The common value for Perior Indicator are, depending on sap logon language are:

  • D – ‘ ‘ ? – Day
  • W – ‘1’ – Week
  • M – ‘2’ – Month
  • Y – ‘3’ ? – Year

All the value can be found in SAP table ?PRDKZT for?Language-dependent texts for SLED period indicator



Hi. I have been working as SAP Technical and functional for a decade. Through this blog, I am trying to share with you my experience. Hopefull, it makes your ways easier path ... Sab

You may also like: