TABLES:ZFF_SYINGFU.
PARAMETERS S_RYEAR TYPE ZFF_SYINGFU-RYEAR OBLIGATORY DEFAULT SY-DATUM.
SELECT-OPTIONS S_MONAT FOR ZFF_SYINGFU-MONAT OBLIGATORY.
DATA: FIR_DATA TYPE SY-DATUM. "第一天
DATA: LAS_DATA TYPE SY-DATUM. "最后一天
DATA: LAS_DATA1 TYPE SY-DATUM. "最后一天
FIR_DATA = SY-DATUM.
*LAS_DATA = SY-DATUM.
CONCATENATE S_RYEAR S_MONAT-HIGH INTO LAS_DATA.
FIR_DATA+6(2) = ‘01‘. "月份的第一天
LAS_DATA+6(2) = ‘28‘. " 令当前日期为28号
LAS_DATA = LAS_DATA + 5. " 月的天数最多为31天,+5 后肯定为下个月的莫一天。
LAS_DATA+6(2) = ‘01‘. "下个月的第一天
LAS_DATA = LAS_DATA - 1. " 这个月的最后一天
*WRITE: SY-DATUM,FIR_DATA,LAS_DATA.
*CALL FUNCTION ‘BKK_GET_MONTH_LASTDAY‘
* EXPORTING
* I_DATE =
* IMPORTING
* E_DATE =
* .
*CALL FUNCTION ‘LAST_DAY_OF_MONTHS‘
* EXPORTING
* DAY_IN = ‘20190927‘
* IMPORTING
* LAST_DAY_OF_MONTH = LAS_DATA1
** EXCEPTIONS
** DAY_IN_NO_DATE = 1
** OTHERS = 2
* .
*IF SY-SUBRC <> 0.
** Implement suitable error handling here
*ENDIF.
WRITE:LAS_DATA1.
原文地址:https://www.cnblogs.com/salah/p/11917056.html