Con la funcuón estándar de SAP FKK_LAST_DAY_OF_MONTH obtendremos el último día del mes pasándole una fecha.
Parámetros de Entrada
- DAY_IN: Fecha con la que queremos obtener el último día del mes
Parámetros de Salida
- LAST_DAY_OF_MONTH: Fecha con el último día del mes
Función
DATA: lv_last_day TYPE datum.
CALL FUNCTION 'FKK_LAST_DAY_OF_MONTH'
EXPORTING
day_in = sy-datum
IMPORTING
LAST_DAY_OF_MONTH = lv_last_day
EXCEPTIONS
DAY_IN_NO_DATE = 1
OTHERS = 2.
IF sy-subrc <> 0.
ENDIF.