Duplicate Invoices while saving document through MIR7

Hello,
I have to Post the invoice document through MIR7. This can be done through MIRO as well but the end user is using MIR7 for this purpose by parking and then posting the document.
Problem here is that once user has posted the invoice document, he is able to post the same document again by just changing the reference document number field in MIR7, which leads duplicate  invoices.
Here we need to control this by manually putting some conditions. I tried to find the exit and BADI but was able to get only one useful thing that is BADI "INVOICE_UPDATE".
I am not sure about this BADI but in case if this BADI can be used then I want to know how?
Also if not then what are the possible solutions to resolve the issue.
I am open for any further inputs.
Thanks,
Harjeet

Hello Pablo,
In the BADI I am using table TI_RSEG_NEW, there I am getting values same as listed below for MIR7 but instead I am getting the values of BELNR as well. Here the second column is BELNR which is blank for MIRO.
                                                                                1     110  |                |2011 |000001|0411000942|00010|00   |000000000009000029   |
    2     110  |                |2011 |000002|0411000942|00020|00   |000000000003000013   |
Code for the same is:
if sy-ucomm eq 'COMP'.
        select ebeln
               ebelp
               zekkn
               gjahr
               buzei
               bewtp
          from ekbe into table i_ekbe
          for all entries in ti_rseg_new
          where ebeln = ti_rseg_new-ebeln
            and ebelp = ti_rseg_new-ebelp
            and zekkn = ti_rseg_new-zekkn
            and gjahr = ti_rseg_new-gjahr
            and buzei = ti_rseg_new-buzei+2(4).
      endif.
      if sy-ucomm = 'BU'.
        select ebeln
               ebelp
               zekkn
               gjahr
               belnr
               buzei
               bewtp
          from ekbe into table i_ekbe_belnr
          for all entries in ti_rseg_new
          where ebeln = ti_rseg_new-ebeln
            and ebelp = ti_rseg_new-ebelp
            and zekkn = ti_rseg_new-zekkn
            and gjahr = ti_rseg_new-gjahr
            and belnr = ti_rseg_new-belnr
            and buzei = ti_rseg_new-buzei+2(4).
        if sy-subrc eq 0.
          select belnr
                 gjahr
                 vgart
            from rbkp into table i_rbkp
            for all entries in i_ekbe_belnr
            where belnr = i_ekbe_belnr-belnr
              and gjahr = i_ekbe_belnr-gjahr.
        endif.
      endif.
      loop at ti_rseg_new into wa_rseg_new.
        if sy-ucomm = 'COMP'.
          clear v_message.
          read table i_ekbe into wa_ekbe with key
                                         ebeln = wa_rseg_new-ebeln
                                         ebelp = wa_rseg_new-ebelp
                                         zekkn = wa_rseg_new-zekkn
                                         gjahr = wa_rseg_new-gjahr
                                         buzei = wa_rseg_new-buzei
                                         bewtp = 'T'.
          if sy-subrc eq 0.
            concatenate 'Purchasing Document Number' wa_ekbe-ebeln 'is already parked.' into v_message separated by space.
            message v_message type 'E'.
          else.
            clear v_message.
            read table i_ekbe into wa_ekbe with key
                                           ebeln = wa_rseg_new-ebeln
                                           ebelp = wa_rseg_new-ebelp
                                           zekkn = wa_rseg_new-zekkn
                                           gjahr = wa_rseg_new-gjahr
                                           buzei = wa_rseg_new-buzei
                                           bewtp = 'Q'.
            if sy-subrc eq 0.
              concatenate 'Purchasing Document Number' wa_ekbe-ebeln 'is already Posted.' into v_message separated by space.
              message v_message type 'E'.
            endif.
          endif.
        elseif sy-ucomm = 'BU'.
          clear v_message.
          read table i_ekbe_belnr into wa_ekbe_belnr with key
                                         ebeln = wa_rseg_new-ebeln
                                         ebelp = wa_rseg_new-ebelp
                                         zekkn = wa_rseg_new-zekkn
                                         gjahr = wa_rseg_new-gjahr
                                         belnr = wa_rseg_new-belnr
                                         buzei = wa_rseg_new-buzei
                                         bewtp = 'Q'.
          if sy-subrc eq 0.
**          READ TABLE s_rbkp_new WITH KEY belnr = wa_ekbe_belnr-belnr
**                                         gjahr = wa_ekbe_belnr-gjahr.
**          IF sy-subrc EQ 0.
            read table i_rbkp into wa_rbkp with key belnr = s_rbkp_new-belnr
                                                    gjahr = s_rbkp_new-gjahr
                                                    vgart = s_rbkp_new-vgart.
            if sy-subrc eq 0.
              concatenate 'Purchasing Document Number' wa_ekbe_belnr-ebeln 'is already posted.' into v_message separated by space.
              message v_message type 'E'.
            endif.
*          ENDIF.
          endif.
        endif.
      endloop.

Similar Messages

  • Error occurred while saving document in Web Analysis Studio

    We have encountered an issue when we tried to save a new report in Web Analysis. An error message box will prompt up displaying "Error occurred while saving document." (Please refer to the attached screenshots). Clicking the details button gives no response.
    Originally we encountered this whilst creating a report with an SQL spreadsheet (JDBC connection tested successfully), which failed to save. Proceeding to test this saving a blank report also gave the same error message.
    The report shows up in the Oracle view, however also produces an error when trying to open it. "Unable to perform request
    Undefined exception encountered. Recommended Action: Contact your corporate technical support." (Please refer to the attached screenshots)
    Web Analysis version 11.1.2.3.000.1175
    Please advise on how to handle this case

    Hi Soumya,
    Thanks for your reply. I am already using the admin account which is given administrator provisioning under Reporting & Analysis. I have not had issues in the past of saving documents to the server location (e.g. with FR studio). Any ideas as to what else could cause this error? Thanks!

  • Error while generating document through bursting process

    <?xml version="1.0" encoding="UTF-8" ?>
    - <BURS_REPORT>
    <REQUESTID>29462818</REQUESTID>
    <PARENT_REQUESTID>29462816</PARENT_REQUESTID>
    <REPORT_DESC>RDA Invoice Print Selected Invoices XML</REPORT_DESC>
    <OUTPUT_FILE>/applog/common/app/RDDEV3/out/RDDEV3_uspvloradev1/o29462818.zip</OUTPUT_FILE>
    - <DOCUMENT_STATUS>
    <KEY />
    <OUTPUT_TYPE>pdf</OUTPUT_TYPE>
    <DELIVERY />
    <OUTPUT />
    <STATUS>fail</STATUS>
    <LOG>Error while generating the Document...</LOG>
    </DOCUMENT_STATUS>
    </BURS_REPORT>

    Hi,
    only MM documents will be reveresed through MR8M transaction code.
    so what ever document you have created in MIRO and want to reverese it.
    enter the same document number and do the MR8M transaction.
    then the debit will be credit and credit will be debited.
    when you do the reversal original value will be zero and gets knock off.
    so, redo the process.
    Regards,
    Padma

  • Lock Error while posting document through bapi_acc_document_post

    Hi,
       We are trying to Post documents in R/3 using Bapi_acc_document_post from BW system using ABAP report. The report groups data using certain criteria and makes a Bapi call for each group.
    Problem : The program has 2 modes test mode and actual run.
    When the program was run in a test mode 15 groups were created. Hence 15 documents should get created in R/3.
    Now when the actual run was done the program gave an output saying doc1 created,doc2 created....doc11 created.. and suddenly Bapi error .. doc1 is locked by another user, doc1 is locked by another user, doc1 is locked by another user, doc1 is locked by another user.
    Moreover Doc1 never got created in R/3. Doc 2 to Doc11 were created in R/3 and then the BApi error.
    Can anyone please help me understand why this could have happened?
    P.S : We use same Bapi for Check run as well as Actual run. Only difference is that in actual run a BApi_commit is done.
    Do you think using BAP_ACC_DOCUMENT_CHECK during check run will help ?
    PLease advice.

    Setting the WAIT parameter = 'X' will make your updates synchronous which might solve your problem.
    Please try and let me know.

  • BAPI for Vendor Non-PO Invoice processed through MIR7 Transaction

    Hi All,
    I have a requirement where i will get data from flat file. Using this data Vendor Non-PO Invoice
    will be processed through MIR7 transaction with Multiple line items - Invoice Upload Parking the document for vendor non-po invoices.
    The data is in below format in flat file:
    Header fields in 1st line
    Dr. Key related fields in 2nd line
    Cr. Key related fields in 3rd line
    Header fields in 4th line
    Dr. Key related fields in 5th line
    Cr. Key related fields in 6th line
    etc .... in flat file
    In these main fields coming in from flat file are: comp.code, doc.type, vendor no,
    Debit/Credit indicatorSHKZG, G/L a/c no, inv/post dates etc..
    My issues:
    1. I am planning to use F.M BAPI_INCOMINGINVOICE_PARK is it the correct F.M!
    But Here PO number seems to be mandatory for this F.M but it is not available as per our flat file,
    if so can anybody suggest a BAPI for Vendor Non-PO Invoice parking for MIR7 transaction!
    2. What are the parameters need to be used for from above flat file data especially for 2 line itemshttp://Dr./Cr. data other than header data. So as per Header & 2 Line items http://Dr. & Cr. Data which parameters will be updated with which data in above flat file! can anybody clarify!
    3. Also in flat file WorkflowNo is available in which parameter this fields will need to be filled & also by doing this will it trigger workflow automatically!
    Can anybody clarify about above points!
    Thanks in advance.
    Thanks,
    Deep.

    Hello Deep,
    I know it might be quite late for you for this answer, nevertheless I will write that, because there are lots of question like yours. bapi_incominginvoice_park is also a suitable bapi for you. All you need to do is call it this way:
    data: headerdata like bapi_incinv_create_header value is initial,
            table_item type table of bapi_incinv_create_item,
            gl_account like bapi_incinv_create_gl_account,
            table_gl type table of bapi_incinv_create_gl_account.
    * fill headerdata and table_gl, leaving table_item empty
    CALL FUNCTION 'BAPI_INCOMINGINVOICE_PARK'
        EXPORTING
          HEADERDATA                = HEADERDATA
    *   ADDRESSDATA               =
        IMPORTING
          INVOICEDOCNUMBER          = lv_docnr
          FISCALYEAR                = lv_year
        TABLES
          ITEMDATA                  = table_item
    *      ACCOUNTINGDATA            = table_acc
          GLACCOUNTDATA             = table_gl
    *   MATERIALDATA              =
    *      TAXDATA                   = table_tax
    *   WITHTAXDATA               =
    *   VENDORITEMSPLITDATA       =
          RETURN                    = lt_return.
    This works perfectly for me, creating a mir7 document without refering to a PO. The trick here is to fulfill the glaccountingdata importing table while leaving itemdata empty.

  • Error occurred while saving SAP Lumira 1.15.1 document

    Hi All,
    I got error while saving document in SAP Lumira 1.15.1(Error Desc. : you do not have permission to save the document to its current location). and also occurred while sharing on cloud. Below fig.1 shows while saving and fig 2.shows error while sharing on cloud.
    Currently I am using SAP lumira 1.15.1. Build 879
    fig 1.
    fig 2.

    Hi,
    I faced the same situation while trying to save the document. Since i dint get any valid resolution, i just restarted the Lumira, and now i could save the documents.
    Restarts helps most of the times though it is not recommendable.
    As someone said earlier, it has something to do with Session corruption.
    Lumira Version : 1.15.1
    Regards,
    Sahana

  • Issue while saving long text through MS Word Editor in SAP

    Hi All,
    I am facing some issue while saving text through Word editor in SAP(like Notes in Installation or Long Text in device location).
    After entering the text, when I am pressing the Back button, it says text transferred successfully, but when I try to see the text again, its not in the proper format.
    Every time I go to the word editor, some text is deleted.
    Thanks in advance for your help.
    Manoj Vatwani

    Hi Manoj,
    Can you share some screenshot for the formatting issue that you are facing.
    Thanks,
    Amlan

  • Duplicate invoice check on MIRO/Logistics invoice verification.

    Hi SAP Gurus,
       I am stuck with a small issue here. I am trying to post an invoice through FB60 with same vendor, same comp code, same GL and same reference and I am aware there are two settings to do the duplicate invoice check one is through vendor master (payment transaction screen) and the other is OMRDC transaction where we check certain fields to validate invoices based upon same values. now when I take a vendor without that vendor master config for duplicate invoice check and checking all the fields in OMRDC transaction the system doesn't validate or throw any error while posting FB60 with all the same values. so is there any other configuration available apart from these two configuration settings?
      My requirement is the configuration already exists which checks duplicate invoice based upon same invoice date  for all the vendors of a company code and I need to change the configuration setting back where it ignores checking invoice date. it doesn't show any kind of error in my test whether I make change in OMRDC transaction or not.
    Regards,
    Bob

    Hi,
    Try check link below:-
    http://help.sap.com/saphelp_afs30b/helpdata/en/ce/4f3e39ea3aee02e10000000a114084/content.htm
    Regards,
    Fauzi

  • Duplicate invoices

    Presently, Invoices in the SAP system are getting posted using XMS upload program.
    Problem:
    System is not giving error message or not stopping the XMS upload program from posting two invoices with same reference number and text description (even though date of posting is different)?
    Please suggest some ways as to how to avoid these duplicate invoices posting.
    Note: If this has to be resolved using substitution rule then please explain the exact procedure to be followed for that.

    I assume that the duplicate invoice check you are talking is for Vendor invoices in AP and LIV.
    I am not sure what you mean by XMS upload but here is how duplicate invoice check works in standard system.
    Standard Duplicate invoice check on vendor master enables the system to block duplicate (Same invoice reference, company code, invoice date, amount and vendor). If either of these differ the system allows the invoice to get processed.
    So as per requirement of our client we developed a new validation rule that checks a invoice document while posting for any duplicates accross all company codes and for vendor invoices.
    Prereq:If inv doc type is KR or RE
    Validation: In user exit
    Write code for checking same reference in BKPF-XBLNR=XBLNR and BKPF-Doc Date=Doc Date.
    If there exists same XBLNR check for
    BSEG-Posting Key=31, BSEG-LIFNR=LIFNR;  and issue the message for duplicate check.
    Note: This will still post duplicate invoices if the document date is changed. If you want to block the invoices accross all document dates remove the code of BKPF-Doc Date check.
    But understand the implication. You are telling the system to check for duplicate invoices accross all posting dates. Hence if you are looking 1 yr or 2yrs down the lane the system will slow down alot for invoice posting given that it has to check invoices accross all dates. If you have a seperate doc type for XMS upload you can control the validation by doc type.
    Hope it resolves your issue.
    Thanks,
    Sivaram

  • Error while releasing document.

    hi to all,
    while releasing document through vf02 error is coming "tax code does not appear in any g/l account" i have made a new tax code and copied condition type jlst and created new condition type.respective gl is also assigned in ob40.still error is coming.
    i have also checked pricing procedure condition type "from" and "to" its blank.
    please advise.
    thanks and regards
    nakul raj

    Hi,
    The same issue was discussed so many times.  Pl check the below thread.
    tax code x does not appear in G/L account of any item
    Regards,
    P Gomatheeswaran

  • Error while saving after changing the date of a parked invoice document in MIR7

    DUPREC:POS&INCOMINGINVOICE&(Invoice Number)(Fiscal Year)
    Message no. CD328

    Hi,
    Hope you are getting the dump Please check this note 1687903 - MIR4: Dump while saving parked invoice
    also check the dump at ST21 for the ABAP statement whare it is getting an issue and rectify the same .
    Regards,

  • Error while triggering program through output type while saving invoice

    Hi,
    I have a scenario where in my Z program needs to be triggered when saving a invoice.
    For that we have attached out Z program to output type which gets picked while saving invoice.
    In the Z program we have written the entire code in Form Entry subroutine.
    In the Z program we have called a FM "SD_SALESDOCUMENT_CREATE", to create a sales order.
    After sales order is created we have used a Commit statement.
    If I run the Z program individually, Salesorder gets created perfectly.
    How ever as per scenario when trying to save the invoice, output type gets picked. But program doesn't get called.
    and when I go to the saved the invoice I get the following error immediately:
    "Error document - Update was terminated"
    I have found that the problem is with COMMIT statement through transaction SM13.
    Can anybody help me with this. I cannot save the sales order without COMMIT, so I have to use it.
    Thanks in Advance,
    Rohan.

    Hi Rohan,
    I have worked on almost similar kind of requirement as you. 
    "Error document - Update was terminated" is because saving of invoice is done in u201CUpdate Tasku201D. Again in that work process, FM also calls for update task, which is not allowed and give short dump.
    Here are two different approaches to cope up in this scenario.
    1.Call FM in NEW TASK.
    Calling Function module in new task will assign new work process and will use different update task.
    Use:
    CALL FUNCTION 'SD_SALESDOCUMENT_CREATE' STARTING NEW TASK 'task'
    This will not give update termination error.
    Call of FM in this way will work, but as this will be asynchronies call you will be not able to get status/message out of the FM call result.
    If capturing return message is mandatory, use below approach
    2, Process output type via Job
    Set output type, dispatch time u201CSend with periodically scheduled jobu201D in u201CDefault valueu201D tab.
    Run batch job for program u201CRSNAST00u201D with appropriate variant.
    Please let me know if you need any further details.
    Best Regards,
    Nisarg

  • Create Follow-up document from Service Contract automatically while saving

    Hi,
    In CRM 4.0, under the Service secnario, Service Data for Service Contract is related to --
    1. Interval value
    2. Period
    Based on these parameter values how to generate the corresponding follow up documents automatically while saving the parent doucment(i.e Service Contract).
    For ex, Interval = 6 , Period = 36, then all the 6 docs should be genarated at once while saving the Service Contract.
    Please Advice.
    Regards
    Deb

    Hi
    Yes , manually executing the Action through PPF.
    But the requirement is to generate the subsequent docs at once while saving the Service Contract i.e the corresponding Action should also triggered automatically.
    Please Advice.
    Regards
    Deb

  • User Exit while saving the Excise Invoice in J1IIN

    Dear All,
    I want know whether anu User Exits are there while saving the Excise Invoice in J1IIN.
    The "scenario" here is as follows:
    ---I will create an invoice(Commercial) in VF01. Suppose I got a number 1234(This is Billing Document number).
    ---Now I will go to J1IIN and create an Excise Invoice by reffering to the VF01 Billing Doc Number.I will enter all the details. Then I will Save it. While saving I want to check the following aspect:
                         I want to compare the Billing Document Number and Excise Invoice Number and give error if both the numbers are not same.
    ---That is I want to see that Excise Invoice and Billng Document number should be same.
    I need your suggestion in the above scenario.
    I will definitely reward if problem is solved.
    Regards,
    Raj Kumar Reddy.

    Hi Raj,
    Here is a list of available userexits for transaction J1IIN :
    J_1I7_USEREXIT_DEPOT_BEF_SAVE
    J_1I7_USEREXIT_DUTY_IN_EXPORT
    J_1I7_USEREXIT_EXCISE_BEF_SAV
    J_1I7_USEREXIT_EXGRP_DETERM
    J_1I7_USEREXIT_SERGRP_DETERM
    hope they are of some use.
    Regards,
    Philip Johannesen

  • Error while saving the excise invoice

    Hi All,
    I am getting the following error while saving the excise invoice.
    No account is specified in item 0000000001
    Message no. F5670
    Diagnosis
    No account was specified for account type "S" in item "0000000001" of the FI/CO document.
    System Response
    The Financial Accounting program cannot process the document.
    Procedure
    A system error has probably occurred in the application you called up. Check the data transferred to item "0000000001" of the FI/CO document.
    I have read all the posts with regards to the error before, however still after doing the required settings I am getting the error. Please let me know for the same.
    Kind Regards
    Atul Keshav

    Dear All,
    The issue stands resolved please find below the required settings which need to be done.
    You need to maintain the following entries in  J_1ITRNACC table
    100 DLFC 01 CR PLAAED
    100 DLFC 01 CR PLABED
    100 DLFC 01 CR PLACESS
    100 DLFC 01 CR PLASED
    100 DLFC 01 CR PLAAT1
    100 DLFC 01 CR RG23AAt1
    100 DLFC 01 CR RG23AED
    100 DLFC 01 CR RG23BED
    100 DLFC 01 CR RG23SED
    100 DLFC 01 DR MSUSP
    Also the table J_1ITRNACC should include entries for GRPO, CAPE, DIEX, EWPO,
    TR6C with subtransaction type 01.
    We need to maintain GL Accounts accordingly in the table  J_1IEXCACC.
    If still the error persists then you need to apply the following notes.
    1018071
    978186
    1032813
    The SAP note 1032813 contains the correction for the program MJ1IINF01
    you will have to apply this manually.
    Kind Regards
    Atul Keshav

Maybe you are looking for