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

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

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.

Similar Messages

  • Block cancellation/creation of billing document on CLOSED posting period

    Hi Experts,
    Currently, user is allowed to cancel/create backdated billing document where period already closed, but it does not release to accounting automatically, due to the period has been closed.
    When account user found out that the accounting document is missing for the billing document, they have to re-open the period and manual release it to accounting, in order to generate the accounting document.
    Therefore, we need the billing document to be blocked for cancellation/creation on CLOSED posting period.
      Is there any settings in stardard SAP to block cancellation/creation of billing document on CLOSED posting period?
    would appreciate your inputs.
    Thanks and Regards,
    N.C.Reddy

    Hi ,
    We have blocked cancellation/ creation of billing document through below  user exit. Below is the progran code also.
    ***INCLUDE RV60AFZC.
    FORM USEREXIT_NUMBER_RANGE_INV_DATE USING US_RANGE_INTERN.
    Example: Number range from TVFK like in standard
    US_RANGE_INTERN = TVFK-NUMKI.
    *{   INSERT         KPDK904773                                        1
    *Block creation or cancellation of billing doc in closed period
    DATA : gv_gjahr TYPE bkpf-gjahr,
           gv_monat TYPE bkpf-monat,
           gv_poper TYPE t009b-poper,
           gv_bukrs TYPE t001-bukrs,
           lv_gjahr TYPE t001b-frye1,
           lv_monat TYPE t001b-frpe1,
           gv_oper  TYPE t001b-frpe1.
      CLEAR : gv_gjahr, gv_monat, gv_poper, gv_bukrs.
      gv_bukrs = vbrk-bukrs.
    IF NOT likp-wadat_ist IS INITIAL.
    *- First determine the Period of the Actual GI date.
      CALL FUNCTION 'FI_PERIOD_DETERMINE'
        EXPORTING
          i_budat              = likp-wadat_ist
          i_bukrs              = gv_bukrs
       IMPORTING
         E_GJAHR              = gv_gjahr
         E_MONAT              = gv_monat
         E_POPER              = gv_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.
           MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                   WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
          ELSE.
            CLEAR : lv_gjahr, lv_monat.
            lv_gjahr = gv_gjahr.
            lv_monat = gv_monat.
    *- Once period is determine check whether Period is open or not for 'D' - Customer Account
            CALL FUNCTION 'FI_PERIOD_CHECK'
              EXPORTING
                I_BUKRS                = gv_bukrs
                i_gjahr                = lv_gjahr
                i_koart                = 'D'
                i_monat                = lv_monat
             IMPORTING
               E_OPER                 = gv_oper
             EXCEPTIONS
               ERROR_PERIOD           = 1
               ERROR_PERIOD_ACC       = 2
               INVALID_INPUT          = 3
               OTHERS                 = 4.
              IF sy-subrc <> 0.
               MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                       WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
              ELSE.
    *- Once period is determine check whether Period is open or not for 'S' - All G/L Accounts
                CALL FUNCTION 'FI_PERIOD_CHECK'
                EXPORTING
                  I_BUKRS                = gv_bukrs
                  i_gjahr                = lv_gjahr
                  i_koart                = 'S'
                  i_monat                = lv_monat
               IMPORTING
                 E_OPER                 = gv_oper
               EXCEPTIONS
                 ERROR_PERIOD           = 1
                 ERROR_PERIOD_ACC       = 2
                 INVALID_INPUT          = 3
                 OTHERS                 = 4.
                IF sy-subrc <> 0.
                  MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                     WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
               ENDIF.
             ENDIF.
         ENDIF.
    ENDIF.
    *- Check Billing Date period is closed or not
    IF kom-fkdat is not initial.
      clear : gv_gjahr, gv_monat, gv_poper.
    *- First determine the Period of the Actual GI date.
      CALL FUNCTION 'FI_PERIOD_DETERMINE'
        EXPORTING
          i_budat              = kom-fkdat
          i_bukrs              = gv_bukrs
       IMPORTING
         E_GJAHR              = gv_gjahr
         E_MONAT              = gv_monat
         E_POPER              = gv_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.
           MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                   WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
          ELSE.
            CLEAR : lv_gjahr, lv_monat.
            lv_gjahr = gv_gjahr.
            lv_monat = gv_monat.
    *- Once period is determine check whether Period is open or not for 'D' - Customer Account
            CALL FUNCTION 'FI_PERIOD_CHECK'
              EXPORTING
                I_BUKRS                = gv_bukrs
                i_gjahr                = lv_gjahr
                i_koart                = 'D'
                i_monat                = lv_monat
             IMPORTING
               E_OPER                 = gv_oper
             EXCEPTIONS
               ERROR_PERIOD           = 1
               ERROR_PERIOD_ACC       = 2
               INVALID_INPUT          = 3
               OTHERS                 = 4.
              IF sy-subrc <> 0.
               MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                       WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
              ELSE.
    *- Once period is determine check whether Period is open or not for 'S' - All G/L Accounts
                CALL FUNCTION 'FI_PERIOD_CHECK'
                EXPORTING
                  I_BUKRS                = gv_bukrs
                  i_gjahr                = lv_gjahr
                  i_koart                = 'S'
                  i_monat                = lv_monat
               IMPORTING
                 E_OPER                 = gv_oper
               EXCEPTIONS
                 ERROR_PERIOD           = 1
                 ERROR_PERIOD_ACC       = 2
                 INVALID_INPUT          = 3
                 OTHERS                 = 4.
                IF sy-subrc <> 0.
                  MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                     WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
               ELSE.
                IF kom-fkdat4(2) <> likp-wadat_ist4(2).
                ENDIF.
               ENDIF.
             ENDIF.
         ENDIF.
    ENDIF.
    *}   INSERT
    ENDFORM.
          FORM USEREXIT_FILL_VBRK_VBRP                                  *
          This userexit can be used to fill fields in VBRK and VBRP     *
          Be aware, that at this time the work areas KUAGV KURGV        *
          KUWEV and KUREV are not filled.                               *
          This form is called from FORM VBRK_VBRP_FUELLEN.              *
    FORM USEREXIT_FILL_VBRK_VBRP.
    Example: change Tax country
    VBRK-LANDTX = T001-LAND1.
    ENDFORM.
    *eject

  • Automatic creation of billing documents

    Hi all,
    i want to automate creation of billing document for all the deliveries for which PGI done.
    i think we have to define a job which will call VF04.
    my question is when we do VF04 manually, we have to give selection criteria like sales org etc and then it displays the list of all the deliveries and then we have to select the deliveries and press collective billing/individual billing.
    so when the batch job calls the VF04, how all the deliveries are selected and the selection criteria taken into account by the batch job,
    regards
    sachin

    hi,
    thanks for the reply.
    my mian question was when the batch job calls the VF04 and the slection criteria is filled using variants, then the list of deliveries is called up by VF04. my question is how will the batch job select all the deliveries for invoice creation beause whn we run the VF04 witout bathc jb ,we need to select the deliveries for billing (either collective or individual)
    reards
    sachin

  • Backgorund job for automatic creation of billing document

    Dear All
    Could you advise me on how to set up a bacground job for automatic creation of billing document?
    Thanks and regards,
    Sylwia

    In standard, you cannot generate automatic billing but you can set date and time so that you can generate invoices at the specified time in bulk.  The TCode to achieve this is VF06.
    thanks
    G. Lakshmipathi

  • Bacground job for automatic creation of billing document

    Dear All
    Could you advise me on how to set up a bacground job for automatic creation of billing document?
    Thanks and regards,
    Sylwia
    Edited by: S. KOWALSKA on Jan 12, 2009 10:12 AM

    Dear Sylwia
    Please dont post the same question in multiple threads.  You are receiving feedback in the other forum.  Check this link
    [Backgorund job for automatic creation of billing document   |Backgorund job for automatic creation of billing document;
    thanks
    G. Lakshmipathi

  • Automatic creation of billing document

    Hi all,
    i want to automate creation of billing document for all the deliveries for which PGI done.
    i think we have to define a job which will call VF04.
    my question is when we do VF04 manually, we have to give selection criteria like sales org etc and then it displays the list of all the deliveries and then we have to select the deliveries manually and press collective billing/individual billing.
    so when the batch job calls the VF04, how will the batch job tells VF04 to select all deliveries and generate the invoices.
    regards
    sachin

    Hi Sonu,
    Go to VF04 and provide the inputs in the selection screen. Now save this as a variant.say ZZ_INV_DUELIST
    After saving the variant, find the program name of the tcode VF04. This can be found by going to System----Status in the menu. The resultant screen will have the program of the tcode VF04. Lets say it is BILLDUELIST
    Now go to SM36. Give some name for hte job name and click Step button
    Here you have to give the program name(BILLDUELIST) and the variant name(ZZ_INV_DUELIST). Here you can also configure whether the job should run immediately or in some schedules.
    Once this is done, you can create a delivery and then run this program in SM37. Now you can see the log of this program. It will tell you that the invoice is created
    Hope this helps

  • How to find IDOC no with reference to one billing document no

    Dear all,
    Can you please tell :
    How to find IDOC no with reference to one billing document no
    Thanks

    Hi Pavan,
    You are absolutely correct.  But what i need to know is sometime , even in the sales order there will be no output type (basically inbound) which can be found as suggested by Sunil - I think that is the most relevant way to find the IDOC no. Hope you will agree with me. Again how to activate by IAN is also guides the idea. Only thing we need to know the exact parameter to be maintained in own data.
    Thanks for your one of the valid suggestion.
    Regards,
    Ranjan

  • How to display accounting periods in a fiscal year?

    hi gurus,
    could you please tell me how to display accounting wise calculations like AP1, AP2 ... AP12 in a given fiscal year in Bex (BI7.0)?
    please tell me the logic?
    regards

    You can create them
    Non calender year
    Non Year dependent
    Number of Periods 16, Special Periods XX (based on your requirement)
    Use -1 or +1 year shift based on your requirement.
    However, your requirement is wrong. December month is overlapping in both the years. Please recheck.
    Regards,
    Ravi

  • Closed accounting period

    Hi,
    I wanted to ask you some information. Using the 2005 release of SAP.
    When I close the accounting period when you print both the budget and loss account, to prevent others from other records I have to do manually or lock the period when SAP launched the closure period closes by itself?
    Thanks

    Hi,
    You have to lock those periods manually.  B1 would not automatically close them for you.
    Thanks,
    Gordon

  • How to block accounting by MIRO for specific type of documents.

    Hello
    Is there any possibility to block accounting by MIRO for specific type of document? So you could only account specific type of documents by FBV* or FB*.
    Regards
    Marcin Obukowicz

    Hi,
    You can try to make a validation (OB28) which will check the document type based on transaction code prerequisites.
    Regards,
    Eli

  • GL Account is not getting picked by billing document

    Hi Gurus,
    one new GL account is set up by our FI team for a accrual condition type.
    case 1:
    Now when i have cancelled the previous created billing doc and trying to create again then the new GL account is not getting picked.
    case 2:
    Whereas when am doing the complete process flow like sales order creation, delivery and billing then the new GL account is getting picked.
    Could you please let me know what would be the reason for this, why its not getting picked in first case.
    Thanks,
    Ashi

    Hello Preety,
    Unless you see the Revenue Account Determination Analysis for the Billing document, it is very difficult to understand the reason. Please click on the Environment >> Acc.Determination Analysis >> Revenue account in the VF03 screen and find the missing assignment.
    Thanks,
    Suman$

  • Excise Invoice creation error -Billing document does not exists

    Dear Experts,
    I have created supplementary sales order, billing with refernece through sales order by VF01.
    Now I want to create Excise Invoice but system gives error Billing Document does not exists
    I have checked billing document in VBRK table & it is showing in table.
    My item categroy is L2N -and set it to C
    I have assigned Billing type under Outgoing excise invoice ->Assign billing type to delivery type still my excise invoice is not generating.
    Pl. guide me.
    Thanks
    Trupti

    Resolved my problem.
    Actually in Billing item categroy if you put SD Doc. Catg. as M you can do excise invoice even if you have not created the
    outbound delivery.
    So cycle will be Supplementary Sales Order->VF01 with ref. to SO->J1IIN -Excise invoice creation.
    Thanks to all.
    Trupti.

  • How to Create Excise Invoice (J1IIN) with order related billing document

    Dear Experts,
    Is it possible  to Create Excise Invoice (J1IIN) with order related billing document? How? please guide
    Regards
    BK GAIKWAD

    Sir,
    We have make the supplementary Invoice (Debit Note) as per below process
    1) Create sales order_VA01
    2) Create billing document_VF01_with reference to sales order
    3) Create Excise Invoice With J1IS (Other Movement) It is manually job & due to heavy work load (create 200 invoice  per day) it is not possible to do manually.
    Hence we want to create excise Invoice with J1IIN instead of J1IS, any alternative solution for that?
    Regards
    BK GAIKWAD

  • Stop Creation of Billing Document in Future date

    Hi Experts
    We create Billing Document in VF01 on basis of Outbound delivery, system create Billing Document in current date.
    but when we choose future date that time also system create billing Document l in future date .
    Issue : While create Billing Document in future date system should not allow to do the same.System should give error message while creating Billing document in future date.
    please reply as early as possible
    Regards
    Pash@SD

    Hello
    Refer following link:
    - Restrict from entering future billing date
    Thanks & Regards
    JP

  • Creation of Billing Document - Item is not relevant for billing

    Hi
    While trying to Create a Billing document after entering the Order No.the following error msg shown in the Tool Bar
    No Billing Documents were generated. See log
    The Error Log shows the following msg with Yellow coloured indication :
    000000xxxxxx 00010 The item is not relevant for billing.
    Technical Data
    The Technical Data shows the Client
    Group Number
    Sales Document Number
    Item Number of the SD Document
    Schedule Line Number
    Counter in control Tables
    Message in Identification VF
    System Message Number 044
    We need to issue the credit note.
    How to solve this issue?
    If any one knows pls guide me.
    Govind Bhaskaran

    Hi
    Thanks for all of your guidance.
    I checked with existing Sale Order and compare with this S.Order.   I found the following:
    Reason for rejection column selected by "XXXXXXXXXX" - for Curren Sales Order
    Reason for rejection column emply - for existing Sales Order
    I removed the contents and kept it blank.   Then we can create billing document as well
    Cr. Memo without any problems.   Document posted.
    Thanks for your valuable suggestions to get some idea.
    Regards,
    G Bhas

Maybe you are looking for

  • Installing JDK1.5 ON WINDOWS XP

    HI, i have installed jdk1.5 on windows xp.when i type java -version it gives me the correct version ie 1.5.09.but when i type javac -help it gives me an error SAYS"JAVAC NOT RECOGNISED AS AN INTERNAL OR EXTERNAL CMD"...WHY IS THIS?also when i start t

  • Using an ethernet hub with base station

    hi, i'm looking at setting up a home network using an airport extreme base station. at the moment 2 macs will need to hardwired using an ethernet hub (they are in the same room). i'm wondering by using a hub will that lessen performance speed etc to

  • Forms position help

    Hi i have a form which is of the size 800*600 so i use a scroll bar to go the bottom of the fom..i have a button at the bottom to call another form..when i scroll and press the button the other form gets called but the position of the next form is ha

  • Create a Hard Copy

    Hello, I have successfully downloaded Lion from the App Store, is it possible to create a hard copy to put on disk so I know I have it? Thanks

  • Possible to install a new SSD to a 13-inch macbook pro with retina display

    I just bought a 13-inch macbook pro with retina display last week from apple. I want to make this macbook a protable workstation, so I upgraded the RAM to 16G. I also purchased an Samsung 1T SSD 840 EVO, which is suggested from most of the web, but w