F How to get last day of the month using function module in SAP ABAP | CodeTheta

How to get last day of the month using function module in SAP ABAP

October 15, 2023

In the below program I have used RP_LAST_DAY_OF_MONTHS function module to get the last of the month.

Code : 

DATAlast_day TYPE sy-datum.

CALL FUNCTION 'RP_LAST_DAY_OF_MONTHS'
  EXPORTING
   day_in                  sy-datum
 IMPORTING
   last_day_of_month       last_day
 EXCEPTIONS
   day_in_no_date          1
   OTHERS                  2.
IF sy-subrc <> 0.
* Implement suitable error handling here
ENDIF.

WRITE'Last day:'last_day.


IDE Used To Test This Code : ABAP Editor.

Try this code in your computer for better understanding. Enjoy the code. If you have any Question you can contact us or mail us. We will reply you as soon as possible.

Post a Comment