sap 中时间的问题,比如我取到系统时间后,然后要根据该系统时间推算出前三个月的年份和月份,要怎么取?
1个回答
展开全部
DATA: BEGIN OF l_date,
year(4) TYPE n,
month(2) TYPE n,
day(2) TYPE n,
END OF l_date.
l_date = SY-DATUM.
DO 3 TIMES.
IF l_date-month = 1.
l_date-year = l_date-year - 1.
l_date-month = 12.
ELSE.
l_date-month = l_date-month - 1.
ENDIF.
WRITE:/ l_date-year, l_date-month.
ENDDO.
year(4) TYPE n,
month(2) TYPE n,
day(2) TYPE n,
END OF l_date.
l_date = SY-DATUM.
DO 3 TIMES.
IF l_date-month = 1.
l_date-year = l_date-year - 1.
l_date-month = 12.
ELSE.
l_date-month = l_date-month - 1.
ENDIF.
WRITE:/ l_date-year, l_date-month.
ENDDO.
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询