In SAP ABAP, you can get the last date of a given month using the FM LAST_DAY_IN_PERIOD_GET or by calculating it manually using date arithmetic.

1. Using Function Module LAST_DAY_IN_PERIOD_GET

DATA: lv_last_date TYPE sy-datum.
CALL FUNCTION 'LAST_DAY_IN_PERIOD_GET'
EXPORTING
i_gjahr = '2024' " Year
i_periv = 'K4' " Fiscal year variant (use 'K4' for standard calendar year)
i_poper = '03' " Month (March)
IMPORTING
e_date = lv_last_date.
WRITE: 'Last date of month:', lv_last_date.

2. Using Date Calculation (Manual Approach)

DATA: lv_date TYPE sy-datum,
lv_last_day TYPE sy-datum.
lv_date = '20240301'. " First day of the month (YYYYMMDD)
lv_last_day = lv_date + 31. " Add 31 days to ensure we move to the next month
lv_last_day = lv_last_day - ( lv_last_day+1 MOD 100 ). " Get last day of the month
WRITE: 'Last date of month:', lv_last_day.

Both methods work efficiently in ABAP. Let me know if you need further clarifications! 🚀