07-24-2014 8:32 AM
Hi Experts,
I have a requirement to identify the closed periods in sap based on this we need to restrict the creation of billing document .
Actually we are working for Brazil client, there we have notafiscal which created along with billing document.we are maintaining periods monthly basis.
When the periods are closed accounting document not created and billing document is created this is working fine . But over scenario along with billing document notafiscal number is also created which is causing the problem. This notafiscal should not be created without a accounting document.
so my client wants to restrict creation of billing document also when these monthly periods are closed.
Please suggest me a solution.
Regards
Ravi
07-24-2014 9:37 AM
Helllo Ravinder,
To check if a period is closed using the FM FI_PERIOD_CHECK.
First calculate the period of the FI document date.
DATA: GJAHR LIKE BKPF-GJAHR,
MONAT LIKE BKPF-MONAT,
POPER LIKE T009B-POPER.
CALL FUNCTION 'FI_PERIOD_DETERMINE'
EXPORTING
I_BUDAT = I_BUDAT
I_BUKRS = I_BUKRS
* I_PERIV = ' '
* I_GJAHR = 0000
* I_MONAT = 00
* X_XMO16 = ' '
IMPORTING
E_GJAHR = GJAHR
E_MONAT = MONAT
* e_poper = poper
EXCEPTIONS
FISCAL_YEAR = 1
PERIOD = 2
PERIOD_VERSION = 3
POSTING_PERIOD = 4
SPECIAL_PERIOD = 5
VERSION = 6
POSTING_DATE = 7
OTHERS = 8.
IF SY-SUBRC = 0.
MOVE MONAT TO POPER.
CALL FUNCTION 'FI_PERIOD_CHECK'
EXPORTING
I_BUKRS = I_BUKRS
* I_OPVAR = ' '
I_GJAHR = I_GJAHR
I_KOART = '+'
* i_konto =
I_MONAT = POPER
EXCEPTIONS
ERROR_PERIOD = 1
ERROR_PERIOD_ACC = 2
OTHERS = 3.
ENDIF.
Tutorial ABAP How to check that posting date belongs to closed period - ABAP Development - SCN Wiki
I hope you help.
07-24-2014 9:37 AM
Helllo Ravinder,
To check if a period is closed using the FM FI_PERIOD_CHECK.
First calculate the period of the FI document date.
DATA: GJAHR LIKE BKPF-GJAHR,
MONAT LIKE BKPF-MONAT,
POPER LIKE T009B-POPER.
CALL FUNCTION 'FI_PERIOD_DETERMINE'
EXPORTING
I_BUDAT = I_BUDAT
I_BUKRS = I_BUKRS
* I_PERIV = ' '
* I_GJAHR = 0000
* I_MONAT = 00
* X_XMO16 = ' '
IMPORTING
E_GJAHR = GJAHR
E_MONAT = MONAT
* e_poper = poper
EXCEPTIONS
FISCAL_YEAR = 1
PERIOD = 2
PERIOD_VERSION = 3
POSTING_PERIOD = 4
SPECIAL_PERIOD = 5
VERSION = 6
POSTING_DATE = 7
OTHERS = 8.
IF SY-SUBRC = 0.
MOVE MONAT TO POPER.
CALL FUNCTION 'FI_PERIOD_CHECK'
EXPORTING
I_BUKRS = I_BUKRS
* I_OPVAR = ' '
I_GJAHR = I_GJAHR
I_KOART = '+'
* i_konto =
I_MONAT = POPER
EXCEPTIONS
ERROR_PERIOD = 1
ERROR_PERIOD_ACC = 2
OTHERS = 3.
ENDIF.
Tutorial ABAP How to check that posting date belongs to closed period - ABAP Development - SCN Wiki
I hope you help.
07-24-2014 10:54 AM
There are FM in FI and CO for that (remember a period can be closed or opened for different periods depending on account types (F-60) or transaction types (OKP1)
Regards,
Raymond