Find last day of month of a given date in ABAP - Take 2.

yes, ABAP!!!

This is take 2!
* This program will find the last day of month of the given date.
 
PARAMETERS: DATE1 TYPE D.
 
DATA:  DATE   TYPE D,
  YEAR(4)  TYPE N,
  MONTH(2) TYPE N,
  DAY(2)  TYPE N.
 
* Parse the given Date:
DAY = DATE1+6(2).
MONTH = DATE1+4(2).
YEAR = DATE1+0(4).
 
IF MONTH EQ 12.
MONTH = 1.
YEAR = YEAR + 1.
ELSE. 
MONTH = MONTH + 1.
ENDIF.
 
DAY = 01.
 
DATE+0(4) = YEAR.
DATE+4(2) = MONTH.
DATE+6(2) = DAY.
 
DATE = DATE - 1.
 
WRITE: 'Last day of month: ', DATE YYMMDD.