Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

how identify closed accounting period to restrict creation of billing document in sap

Former Member
0 Kudos

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

1 ACCEPTED SOLUTION

Former Member
0 Kudos

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.

2 REPLIES 2

Former Member
0 Kudos

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.

raymond_giuseppi
Active Contributor
0 Kudos

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)

  • For FI use FI_PERIOD_CHECK (either generic opening "+" default or "D" debitor/customer)
  • For CO use K_PERIOD_LOCK_CHECK

Regards,

Raymond