Add days to date ABAP SAP.

ABAP add days to date. Add / subtract days/hour from a date in ABAP or add them to a very useful functionality that can be implemented using the function module TZTF_ADD_DAY. Calling this FM will allow, for example, to receive data for the last n days, where n is entered by the user, or to find the end date of the reserve, which, for example, is 14 days after the order SAP CRM, and much more.

Function module TZTF_ADD_DAY call example:

"for example, lv_date = '20230815'.
" and lv_days = '5'.

  CALL FUNCTION 'TZTF_ADD_DAY'
    EXPORTING
      if_date  = lv_date
      if_time  = CONV t( 0 )
      if_value = CONV i( - lv_days )
    IMPORTING
      ef_date  = lv_date_res.

" as a result lv_date_res = '20230810'.

Main settings:

  • if_date – date from which to subtract (if_date = 16.04.2022)
  • if_time – time to be subtracted ( if_time = 0)
  • if_value – days to subtract (if_value = 17 )
  • ef_date – result, date ( ef_date = 03.05.2022 )

All function method TZTF_ADD_DAY signature with types:

FM TZTF_ADD_DAY

In what task did you use this FM? Do you know an alternative to this Functional module? Write in the comments!

Leave a Reply