通过公司代码和日期,去对应的会计期间和年度函数:G_PERIOD_GET
CALL FUNCTION 'G_PERIOD_GET'
EXPORTING
COMPANY
= P_BUKRS
DATE
= LF_SPMON
LEDGER
=
'0L'
IMPORTING
PERIOD
= GS_SPMON
-PERIOD
"期间
YEAR
= GS_SPMON
-SPMONS
"年度
EXCEPTIONS
LEDGER_NOT_ASSIGNED_TO_COMPANY
=
1
PERIOD_NOT_DEFINED
=
2
VARIANT_NOT_DEFINED
=
3
PARAMETER_ERROR
=
4
OTHERS = 5.
IF SY
-SUBRC <>
0
.
LEAVE
LIST-PROCESSING
.
ENDIF
.