Validation on AP invoice

Hi ,
Client requires validation on AP invoice if purchase invoice value is  greater than Purchase order value.
For e.g. if purchase order is created for Item1 with 10 quantity and 100 price , total will be 1000
and purchase invoice is created as
    Item                quantity             Price           Total
1. Item1               5                      100              500
and when user creates another invoice for same order as :
    Item                quantity             Price           Total
1. Item1               5                      120              600
Here total value i.e. 500+600 =1100 but purchase value is 1000 ,this should trigger message in transaction notification script.
can any one help me with script.

Hi ,
I have this kind of SP_TN on sales order , item master and purchase master tables. And it is working.
You change the fields of your choice.
PASTE THIS CODE IN SQL SERVER
LOCATE YOUR DATABASE
EXPAND PROGRAMABILITY --- STORED PROCEDURE --- DBO.SBO_SP_TRANSACTIONNOTIFICATION
PASTE THIS CODE BELOW ADD YOUR CODE HERE
If (@object_type = '18') and (@transaction_type in ('A' , 'U'))
BEGIN
     Declare @ITEMCODE as varchar(255)     
     Declare @Qty as float
        Declare @POPRICE as float
        Declare @INVPRICE AS FLOAT
     Declare @FrstLine as int
     Declare @LstLine int
     set @FrstLine = (select min(T0.linenum) from PCH1 T0 where T0.docentry=@list_of_cols_val_tab_del)
     set @LastLine = (select max(T0.linenum) from PCH1 T0 where T0.docentry=@list_of_cols_val_tab_del)
     while @FrstLine <= @Lastline
          BEGIN
                      IF EXISTS (SELECT @ITEMCODE = PCH1.ITEMCODE , @POPRICE = POR1.PRICE FROM OPCH INNER JOIN PCH1
                      ON OPCH.DOCENTRY =
                      PCH1.DOCENTRY
                      INNER JOIN POR1 ON PCH1.BASEREF = POR1.OBJTYPE AND POR1.BASELINE = PCH1.LINENUM
                      INNER JOIN OPOR ON POR1.DOCENTRY = OPOR.DOCENTRY WHERE OPCH.DOCENTRY =   
                      @list_of_cols_val_tab_del AND PCH1.LINENUM = @FrstLine)
                      BEGIN
                              SET @InvPrice = (SELECT PRICE FROM PCH1 WHERE DOCENTRY = @list_of_cols_val_tab_del AND 
                              ITEMCODE = @ITEMCODE AND LINENUM = @FRSTLINE)
                              IF @POPRICE <> @INVPRICE THEN
                     BEGIN
                         set @error = -1
                         set @error_message = 'PO PRICE IS DIFFERENT THAN INVOICE PRICE ON LINE NUMBER' +
                                        TRIM(STR(@FRSTLINE))
                    END
                             SET @FRSTLINE = @FRSTLINE + 1
                   END
               END
END
Thanks
Malhaar

Similar Messages

  • Error validating PTO configuration invoice qty

    When we run Receivable Interface from Order Entry to create the receivable invoice, we face the error which states that " Error validating PTO configuration invoice quantity".
    Can any please suggest as how to fix this problem.

    Hi
    Invoice Verification is checking of incoming vendor invoices. The Invoice Management System (IMS) provides you with a central access point for all incoming invoices (with and without purchase order reference). If errors occur when an invoice is posted, one or more exceptions are generated and the invoice appears in the Invoice Monitor.
    The IMS is based on SRM invoice entry
    Please see the related links ->
    Invoice Management System
    http://help.sap.com/saphelp_srm50/helpdata/en/42/dc00a78d23162fe10000000a1553f7/frameset.htm
    Processing Invoices in SRM Using IMS
    http://help.sap.com/saphelp_srm50/helpdata/en/ae/738d42d195173be10000000a155106/frameset.htm
    Duplicate Invoice check in IMS SRM 5.0
    Smartform vs Adobe POs in SRM 5.0
    Do let me know.
    Regards
    - Atul

  • Validation for Duplicate Invoice Entry

    Hi Everyone,
    Currently, it seems that SAP reviews an incoming invoice for reference field (invoice number), invoice date, vendor and company code.  If the comibation of the criteria are met, then a warning message appears stating to review the entry due to a possible duplication.  I've since changed the warning message to an error so that users can not post the duplicate invoice. 
    Now, what is the process of stopping an invoice from being posted that meets the following criteria: (1) vendor, (2) invoice number, (3) amount.  Would this be a validation formula or some sort of user exit or is there standard SAP IMG that can be performed?
    Thanks for the assistance,
    Pete

    hi Peter,
    this should be a substitution exit, should happen in FI, on line item level (check transaction GGB1), for all vendor credit postings (posting key between 31 and 39). The substitution has to be done on field amount (WRBTR), because this is the first point where you have all information you need (I guess the vendor invoice number is saved into header). You have to write a small code in the exit to select possible vendor invoices from BSIK and BSAK. If any found you should issue an error message and block the process.
    hope this helps
    ec

  • Tables affected during invoice validation in AP

    Hi,
    How to know what are the tables gets updated in backend when the invoice is validated from front end.
    Required all the table status before Invoice validation and after Invoice validation.
    Regards
    Saravanan.B

    You could run a trace to find out which tables are involved.
    Thanks,
    Brian

  • AP: daily concurrent request runs but some invoices are never validated

    We have a process running every night (APPRVL module: Invoice Validation) to pick up invoice batches and this process should try to validate the invoices within each batch (we do not use approvals or workflow within AP). The APPRVL process always completes without error. Therefore every invoice within each batch should either have a status of 'validated' or 'requires re-validation'. I keep finding invoices within the batch with a status of 'never validated'. These invoices tend to have 'value' mismatch between the distribution total and the invoice total. I would therefore assume the APPRVL process to place a distribution variance hold on the invoice, but as i say the invoice remains at the status 'never validated' I have checked the log files for the APPRVL process : the logs contain details relating to each invoice picked up within the batch and whether APPRVL has validated successfully or not.
    I have searched through metalink and cannot find any reason why the invoices may be missed. These invoices can be manually validated, although they will require re-validation because of the distribution variance hold placed on it. however it proves that there is no data missing from the invoice
    Does anyone have any ideas as to why the invoices may be missed.
    many thanks for any help you can offer

    Hi,
    this is not normal ..however it is possible ... Can you check the configuration for the profile option "Allow Adjustments to Paid Invoice" set for your payables responsibility .. if this is set to YES, then your system allows modifications to the Invoices even after they are accounted and paid ...
    I guess that should be causing the issue ...
    For performing a test case in your Test/Supt environment, make sure the above profile option is enabled and create an Invoice, validate it and make payment to it ... now again query back the invoice and insert a new line and distribution ... this would make the invoice change to NEEDS REVALIDATION status i.e. match_status_flag = T .. and also placing LINE variance / DIST variance hold ...
    Regards,
    Ivruksha

  • AP Hold on Invoices

    Our accounting department usually sets up invoices before they are ready to be tied to a PO or they are waiting on another department for approval, there are multiple different reasons. In the prior version of Oracle they were able to enter an invoice with out a PO or doing a distribution, click validate and it would automatically be placed on hold. The problem we are running into on the new version is that when you click validate it doesn't place the invoice on hold, it doesn't do anything. It looks like you have to go in and place it on hold by choosing a reason for the hold. I didn't see a generic/universal hold and that's what we need because we do not know ahead of time what the reason for the hold is. Is there a way to do this or will it automatically place it on hold some how?

    If I understood you correctly, you are looking an option to hold the invoices automaticaly that are not matched to any PO instead of doing it manually one by one. If the requirement is this, you may try the folllowing steps.
    In Payables System Set up -
    1. Set up the Invoice Match option as PO or Receipt
    2. Check 'Hold Unmatched Invoices' Check box.
    This set up will put a hold during invoice validation on the invoices that are not matched to PO. You can also enable this option at supplier or supplier site level.

  • Problem With Removal of Validation/Substitution

    Hi all,
    We are currently adding a validation for Vendor Invoice Creation (FB60), however we are experiencing a runtime error.
    When we investigated the cause of the runtime error, it seems that there is a previous validation/substitution that was deleted using transaction OBBH, but the corresponding ABAP code was not removed.  Now, since the program and include where this code is located is standard, how can we remove that particular code please?
    We tried re-generating the substitution/validation code using program RGUGBR00 and RGUGBR01, but it seems it is not working.
    Thanks again in advance.

    Hi,
    Even I have the same problem.
    Even after deleting the substitution code is still exits .
    system generated code in Include GBTAKAMB have an syntax error which is giving short dumps.
    Any help is appreciated.
    Anyone used any SAP NOTE on this.
    TIA
    Rhea.
    Edited by: rhea on Jul 25, 2008 12:11 PM

  • Excise invoice date should be equal to GR Posting date in MIGO (Part1 cap.)

    Hi,
    My client wants to have a date validation of "Excise invoice date should always be equal to GR Posting date" in MIGO (Part1 capturing)" whenever they do Goods receipt for excisable transactions.
    As per SAP standard the system will display an error message whenever excise invoice date is greater than GR posting date in MIGO while capturing Part1.
    But system will not display any error message when Excise invoice date is less than GR posting date. My question is why the system will allow to post the MIGO with part 1 entries when Excise invoice date is less than GR posting date.
    Is there any BADI/User exits to put the validation of  "Excise invoice date should always be equal to GR Posting date" (while capturing part1 in MIGO).
    Also, after implementing this date validation in the SAP system,  any serious impact to business with excise department (Indian excise scenario).
    Please help....
    Thanks & Regards,
    Pavan
    Edited by: cn_pavan on Aug 18, 2009 4:47 AM

    hi
    check whether any std user exit there for this process and code as per your logic and activate it

  • Commercial Invoice no at Migo

    Hi All,
    We are doing Migo for Imports PO , first we have done 103  and here the commercial invoice popup comes with no invoice number and we are just entering and saving the 103 document. Then  we are clearing the invoice for customs vendor in MIRO , now we are releasing the GR blocked stock 105 , system pops up the box which has the commercial invoice number ( Invoice doc number generated in MIRO)  by default ,when we proceed further  system issues a warning message " Document entered is not an Invoice " message number 8I683 , but still migo can be done and we are not sure if this message has any impact in accounting entries which creates for material document. Pls let me know any solution for this issue.
    Thanks in advance
    Benny

    First,SAP not suggesting to capture excise for 103 & 105 movements.
    Refer note 952287 for above subject.
    Document entered is not an Invoice " message number 8I683
    This is a validation message to check entered document number is invoice number or not,yes it will
    accounting impact system if duty will be posted wrongly for other material purchases.
    Check notes 1472109,1303077 for validation of commercial invoice.
    Edited by: Jeyakanthan A on Mar 29, 2011 5:22 PM

  • Control of duplicate invoice posting at T.Code FB70

    Dear Experts
    As per clients need to we need to control with error message when user trying post duplicate customer invoice at T.Code FB70.
    we request your help on how do we can meet this requirement.
    if any body know the relevant application areas for message control, pleas let me know. 
    I tried with application area F5, but it is not working for customer postings.
    Thanks in advance.
    Best regards,
    S. Habib Pasha.

    Hi,
    I used this validation for vendor invoice.
    $$1 is the document number, which is about to be generated after passing through this validation.
    So far as the check part is concerned, I used user exit form and coding in program ZRGGBR000, which is a copy of standard program RGGBR000. The coding is as follows-
    exits-name  = 'U300'.
      exits-param = c_exit_param_none.        "AP Duplicate Invoice Check.
      exits-title = text-104.                 "Posting check
      APPEND exits.
    FORM u300 USING b_result.
    *****Local Variables
      DATA:    l_bukrs   LIKE   bkpf-bukrs,  "Company Code
               l_belnr   LIKE   bkpf-belnr,  "Doucment Number
               l_gjahr   LIKE   bkpf-gjahr,  "Fiscal Year
               l_buzei   LIKE   bseg-buzei.  "Number of Line Item
      b_result  =   b_true.
      SELECT  bukrs
              belnr
              gjahr
         FROM bkpf
         INTO (l_bukrs, l_belnr, l_gjahr)
         WHERE bstat = bkpf-bstat
           AND xblnr = bkpf-xblnr
           AND stblg = ' '.
        IF sy-subrc = 0 .
          SELECT  buzei
             FROM bseg
             INTO l_buzei
             UP TO 1 ROWS
             WHERE belnr = l_belnr
               AND gjahr = l_gjahr
               AND bschl = '31'
               AND lifnr = bseg-lifnr.
            IF sy-subrc = 0.
              b_result =  b_false.
              bkpf-belnr = l_belnr.
            ENDIF.
          ENDSELECT.
        ENDIF.                            "closed for SY-SUBRC
      ENDSELECT.
    ENDFORM.                                                    " U300
    Regards
    K Khatri

  • User exit/BADI to have a validation in MIRO for item level

    Hi Experts,
         My requirement is to do a validation in MIRO (Invoice Verification) transaction, when the user enters the PO details ( T.code - MIRO ) and if the material group in the line item belongs to specific set of material groups, then I want to show a popup stating to choose a different GL account.I am searching for a suitable User exit to implement the above change which I have mentioned. So Could you please suggest me any User exit or BADI Which can be used to incorporate my changes.
    Thanks in advance.
    Regards,
      Srinivas

    Hi,
    check this thread:
    BADI IN MIRO
    Best regards.

  • Basic Invoicing Question

    Hello SD Gurus,
    I have a basic question about customer invoice. I have been in sales for about five years but new to SAP. I was reading through some documentation on how to post invoices. But the way I have always seen it done in an organization is employees place orders. then the order ships, and its invoiced automatically. invoice is never manually entered, order is! Any insight would be appreciated?

    Hi Zack,
    your understanding is correct.The cycle starts from an order/contract placed by customer to sales executive.Once order is being captured all the organization validations (which are customized in SAP basis the organization requirements) comes in to force and a valid order can only be saved.
    Saving an order is kind of acceptance as well as a trigger point for inventory planning (if ATP check is activated).The order includes following basic paarmeters:
    1.Who is customer and where to ship
    2.Which material is being demanded and its availbility on desired delivery date
    3.Statutory Taxation & other commercial/excise taxes applicable.
    4. Collection and realization period
    Once order is completed , the organization plans to ship the material and than comes in picture the inventory availabilty (physical) and logistics arrangement planning.
    The invoice is raised one consignment is ready for despatch for all practical purpose as if material taxable you can not issue it to customer without a valid tax/retail invoice.
    The Invoice generation also triggers the accouting entry basis which collection activity is done.
    Hope I,m able to clarify the SAP step linkage to practical scenrio.
    Regards
    Sanjay

  • Tax When capturing AP invoice

    Hi Gurus
    We are getting the following situation:
    The supplier charge us 2 service in one line. A portion of the service is vatable and the rest tax exempt.
    The Purchase requisitioner does not know the split at the time and raise it as fully vatable. We can not capture the invoice as it is.
    is it possible screen in the tax tab the system allows to c
    capture a base amount which would be the vatable portion the system would then calculate the VAT on this amount and the rest would be posted to cost with no VAT?
    If we can not get this facility how can we resolve the issue above.
    Please advise,
    Thanks,
    Themba

    Hi,
    This hold can be caused by 3 reasons:
    1) No budget exists for the account in the accounting period on the invoice. To remove it create a budget in General Ledger and resubmit invoice validation.
    2) Invoice account is not equal to the purchase order account. Enter different account for
    invoice distribution and resubmit invoice validation.
    3) Detail account not assigned to a parent account. Assign detail account to parent account and
    resubmit invoice validation.
    References:
    R12: Payables Holds Explained - Why They are Applied and How to Remove Them [ID 782398.1]
    Regards,
    Ivruksha

  • ERS generated Invoice Not Editable when Sequential Numbering is enabled

    Dear All,
    We have an issue of the ERS Generated invoice (Autoinvoice) number not editable, if the Sequential Numbering Profile option is set to YES.
    We need to keep the Sequential Numbering enabled to generate the Voucher Number.
    In the case of ERS generated Invoice, the Voucher number won't get generated automatically, if we do the validation of the Invoice.
    But normally created invoices will be generating the Voucher Number, when a validation of the invoice is done, even though the Sequential Numbering profile option is NOT set.
    Our requirement is that the ERS generated Invoice number should be editable, as well as the Voucher Number should get generated automatically when a validation of the invoice is been done.
    How can we achieve this..? Please update....
    many thanks in advance.....

    Hi,
    Have you checked  whether the POdelivery (PO quantity) has cmpleted in the previous invoice? Is the PO marked for ERS? If no please mark for ERS. I hope this will help you. Thanks
    Edited by: Padmasri G on Sep 6, 2011 4:55 AM

  • AP invoice workbench performance issue.

    Hi Guys,
    We have a production system with RHEL 5 ,R12 12.0.6 and DB:10.2.0.4
    WE are facing Performance issue in Inovoice workbench were users when click on Inovoice  batches or Inovoices it takes a lot of time to open the invoice form.
    Also Validation of inovoices consumes a lot of time which is unaccepted .
    Request you please give some pointers or note id to followd already have locked an SR with oracle .
    This is urgent
    Regards,
    Milan

    Please see these docs.
    R12 Invoice Workbench Form Has A Performance Issue [ID 1072338.1]
    Bad Performance When Checking Funds In Invoice Workbench [ID 1091280.1]
    Bad Performance In Invoice Workbench (APXINWKB) Find Window When Searching By Purchase Order [ID 1195623.1]
    R12 AP Invoice Workbench Performance Issues [ID 957105.1]
    Poor Performance On Invoice Validation In The Invoice Workbench [ID 1130313.1]
    Invoice Workbench> Actions: Pay in Full Performance Issue [ID 983804.1]
    Invoice Workbench (APXINWKB) Performance Issue While Selecting The Self Assessment Check Box [ID 1210340.1
    Performance of Project Expenditure LOV At AP Invoice Header in Invoice Workbench [ID 1143943.1]
    R12.1.1 Performance Problem in AP Invoice Workbench [ID 861205.1]
    R12 Invoice Performance FAQs [ID 579737.1]
    Thanks,
    Hussein

Maybe you are looking for