FM to add days to current date

add days to date abap

How to sum days to current date in abap, if you need to sum or add more days to current day you only need to sum days to current days  like example below

add days to date abap

first to all we will define a variable type dats, next, we will asing current date on this vairable, please see next image:

add days to day abap

As you can see, current day its: 16-Nov-2020, then we are going to sum 14 days:

add days to day abap

Now, our variable has change the date to 30-Nov-2020.

REPORT z_pruebas.

DATA: date_now TYPE dats.

date_now = sy-datum.

  date_now = date_now + 30 . "Sum days to actually date .
  
  WRITE: date_now

Another option to solve this its by using the Function Module ADD_TIME_TO_DATE. This function module recive a date and number of days you want to add to that date and return new date.

CALL FUNCTION 'ADD_TIME_TO_DATE'

EXPORTING

I_IDATE = F_DATE " Your Original Date in this parameter

I_TIME = 5 " No.of Days  you want to add to Given date

I_IPRKZ = V_IPRKZ " Indicator D = Days M = Months Y = Years (this because yo can add, days, month or years)

* I_RDMHD =

IMPORTING

O_IDATE = T_DATE " Processed Date

How to send email with excel file attachment from itab in ABAP

Leave a Reply

Your email address will not be published. Required fields are marked *

Go up