DISPLAY LAST DAY OF A MONTH (PARAMETER INPUT):
This program gets the last date of the month for the given input date of the month.
*&---------------------------------------------------------------------*
*& Report Z_LAST_DAY_OF_MONTH
*&
*&---------------------------------------------------------------------*
REPORT Z_LAST_DAY_OF_MONTH.
PARAMETERS : P_DATE LIKE SY-DATUM.
DATA: MONTH(2) TYPE N,
YEAR(4) TYPE N.
YEAR = P_DATE+0(4).
MONTH = P_DATE+4(2).
MONTH = MONTH + 1.
IF MONTH > 12.
YEAR = YEAR + 1.
MONTH = '01'.
ENDIF.
P_DATE(4) = YEAR.
P_DATE+4(2) = MONTH.
P_DATE+6(2) = '01'.
P_DATE = P_DATE - 1.
WRITE:/ P_DATE.
INPUT:
OUTPUT:
This program gets the last date of the month for the given input date of the month.
*&---------------------------------------------------------------------*
*& Report Z_LAST_DAY_OF_MONTH
*&
*&---------------------------------------------------------------------*
REPORT Z_LAST_DAY_OF_MONTH.
PARAMETERS : P_DATE LIKE SY-DATUM.
DATA: MONTH(2) TYPE N,
YEAR(4) TYPE N.
YEAR = P_DATE+0(4).
MONTH = P_DATE+4(2).
MONTH = MONTH + 1.
IF MONTH > 12.
YEAR = YEAR + 1.
MONTH = '01'.
ENDIF.
P_DATE(4) = YEAR.
P_DATE+4(2) = MONTH.
P_DATE+6(2) = '01'.
P_DATE = P_DATE - 1.
WRITE:/ P_DATE.
INPUT:
OUTPUT: