Change days, month or years of an abap date

DATA: lv_date TYPE dats.

lv_date = sy-datum.
"Expected output: 20230626

*--- Add 3 years to the date
lv_date(4) = lv_date(4) + 3.
"Expected output: 20260626

*--- Add 1 month to the date
lv_date+4(2) = lv_date+4(2) + 1.
"Expected output: 20260726

*--- Add 1 day to the date
lv_date+6(2) = lv_date+6(2) + 1.
"Expected output: 20260727

*--- Change date to 31 and month to 12
lv_date+4(4) = 1231.
"Expected output: 20261231

Leave a Reply

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