Validation for duplicate AP invoice

We would like to prevent duplicate AP invoices from being posted through FB60.   We created an FI validation in OB28 in which the prerequisite = Tcode FB60, and the check is a user exit to check the values in vendor / company code / reference fields and if those 3 fields have the same values as in an existing document, to generate an error message preventing the duplicate document from being posted.
The above works well for creating new invoices.   However, when we have to make changes to an existing invoice (created through FB60), the system also calls on that validation and generates the error message, even though the only fields we can change on the invoice is payment terms, payment method, payment method supplement and text. 
Other than modifying the user exit, does anybody know of a better way to do this validation or to prevent duplicate manual invoice from being created?  
thank you.

This has already been answered before so extracted part of the reply
there are two duplicate checks in SAP:
1. the one for FI documents, this is relevant for all F... postings (but nor for MIRO!)
this can be turned off or on (in vendor master record) and 6 fields are checked:
Check Flag for Double Invoices or Credit Memos
Indicator which means that incoming invoices and credit memos are checked for double entries at the time of entry.
Use
Checking Logistics documents
Firstly, the system checks whether the invoice documents have already been entered in the Logistics invoice verification; the system checks invoices that are incorrect, or invoices that were entered for invoice verification in the background.
Checking FI documents
The system then checks whether there are FI or Accounting documents that were created with the original invoice verification or the Logistics verification, and where the relevant criteria are the same.
Checking Logistics documents
In checking for duplicate invoices, the system compares the following characteristics by default:
Vendor
Currency
Company code
Gross amount of the invoice
Reference document number
Invoice document date
If all of these characteristics are the same, the system issues a message that you can customize.
When you enter credit memos or subsequent adjustments, the system does not check for duplicate invoices.
Exception: Country-specific solution for Argentina, where invoices and credit memos are checked for duplicate documents.
No message is issued if you enter a document that has previously been reversed.
Dependencies
The system only checks for duplicate invoices in Materials Management if you enter the reference document number upon entering the invoice.
In Customizing for the Logistics invoice verification, you can specify that the following characteristics should not be checked:
Reference document number
Invoice document date
Company code
This means that you can increase the likelihood that the system will find a duplicate invoice, because you can reduce the number of characteristics checked.
Example
The following document has already been entered and posted:
Reference document number: 333
Invoice date: 04/28/00
Gross invoice amount: 100.00
Currency: EUR
Vendor: Spencer
Company code: Munich
You have made the following settings in Customizing:
The field "Reference document number" and "Company code" are deselected, which means that these characteristics will not be checked.
Now you enter the following document:
Reference document number: 334
Invoice date: 04/28/00
Gross invoice amount: 100.00
Currency: EUR
Vendor: Spencer
Company code: Berlin
Result
Because you entered a reference document when you entered the invoice, the system checks for duplicate invoices.
The reference document number and the company code are different from the invoice entered earlier, but these characteristics are not checked due to the settings you have made in Customizing.
All other characteristics are the same. As a result, the system issues a message that a duplicate entry has been made.
If the "Reference document number" had been selected in Customizing, the system would have checked the document and discovered that it was different from the invoice entered earlier, so it would not have issued a message.
Checking FI documents
Depending on the entry in the field "Reference", one of the following checks is carried out:
1. If a reference number was specified in the sequential invoice/credit memo, the system checks whether an invoice/credit memo has been posted where all the following attributes agree:
Company code
Vendor
Currency
Document date
Reference number
2. If no reference number was specified in the sequential invoice/credit memo, the system checks whether an invoice/credit memo has been posted where all the following attributes agree:
Company code
Vendor
Currency
Document date
Amount in document currency
2. the one for LIV.
this can be customized (as stated above) and is relevant for MIRO (and not for F... postings!).
Company, Reference and Invoice date
Set Check for Duplicate Invoices
In this step, you can configure for each company code if the system is to check for duplicate invoices when you enter invoices.
This check should prevent incoming invoices being accidentally entered and paid more than once.
You can choose whether to activate or deactivate the check criteria of company code, reference document number and invoice date for each company code. The more criteria that you activate, the lower the probability of the system finding a duplicate invoice. The Accounting documents are checked first, followed by documents from Logistics Invoice Verification (only incorrect invoices or those entered for verification in the background).
When checking duplicate invoices, the system compares the following
attributes in the standard system:
Vendor
Currency Company code
Gross invoice amount Reference document number
1. Invoice date If the system finds an invoice that matches all attributes, the system
displays a customizable message.
If you are entering credit memos, subsequent debits, or subsequent
credits, the system does not check for duplicate invoices.
The exception is the Argentina country version, where the system checks
for duplicate invoices and credit memos.
If a previously processed document is later cancelled and then entered
again, no message is displayed.
Requirements
The system only checks for duplicate invoices in Materials Management
if you specify a reference document number when entering the invoice.
In Customizing (IMG) for Invoice Verification, you can specify that the
system check the following attributes

Similar Messages

  • How do i check ensure that SAP checks for duplicate vendor invoice numbers?

    Hi Experts -
    How do I verify that SAP checks for duplicate vendor invoice numbers and blocks duplicate invoices from being paid?
    Thanks!

    Hi
    Pls chek the settigs by following the path
    IMG>Materials Management>Logistics Invoice Verification>Incoming Invoice>Set Check for Duplicate Invoice.
    Here you make the settings for creating a duplicate invoice check.
    Moreever, in the vendor master, you need to tick the check box for duplicate invoice check.
    I suggest you search the Forums before posting a query. There are lots of postings on this issue.
    Thanks & regards
    Sanil K Bhandari

  • 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

  • Validation Check - Duplicate vendor Invoices

    Hi,
    We have a situation where the Duplicate Vendor Invoices have been entered by the users, bearing the same date and reference nos. as the original ones. When we checked we observed that, the system gives the warning message, but the same is ignored by the users. To prevent the same from happening again, we want to convert the warning message into the error message.
    Could any one guide as to how can we set up the validation checks, such that the system would throw an error message. In the vendor masters, we have set up the check for Duplicate Invoices.
    Thanks in advance.
    Best Regards,

    Hi,
    If you already know the message number, then go to T.code:OBA5 or
    T.code:SE91 (if its an custom message class) and change the message from waring to Error.
    If you are not aware of Message, and try to post a duplicate invoice & when the warning message comes, double click on the same, it will give you the message number.
    This will resolve your issue.
    Please let me know the result of the same
    Thanks
    Kalyan

  • Create a validation for check double invoice

    Hi,
    I have read here on SDN for check double invoice on reference number. We want to create an warning message if same reference number is posted twice, not depending on invoice date. So if I, on 1st of October have posted an invoice with reference number 123 and then want to post with same reference number on 2nd of October I want to have an warning message. If I had understand right I need to make a validation for that. Is it true that I need to have a programmer to do that or how am I doing (one thread said that this was the solution, see; )?
    I suppose that my prerequisite will look as follows:
    BKPF-BLART = 'KR' OR BKPF-BLART = 'RE' (I want the check when entering both an invoice in FB60 and MIRO)
    How will my "check step" look like when I want to check if this reference has been entered before? Please describe in technical name.
    Is it possible to do a validation for getting a warning, or is it just possible with error message?
    I have also tried to change in IMG, in Material management > Logistics Invoice Verification > Incoming invoice > Set check for Duplicate invoices. Here we have all fields selected (check co. code, check reference, check inv. date). I changed to just select check reference, but this doesn´t solved my problem.
    Best regards Lisa

    Hello Lisa,
    Your first question,
    Yes system does not check MIRO invoice while posting FB60 invoice. Because when you post invoice with using FB60 transaction, system check BSIP table for duplication. But when you post MIRO invoice system doesn't fill BSIP table.
    So that your question answer is YES, you can register an invoice in MIRO with same reference without a warning.
    Your second question,
    BTE means Business Transaction Event. Those events are known as FI user-exit.
    So that when you posting an invoice with using FB60, system triggered on BTE 00001110 as i said on my previous message.
    I try to explain step by step how can you activate this BTE. But you need to ABAPer for giving warning message on this exit.
    Call FIBF transaction -> Settings -> Products -> ...of a customer
    Create a new line,
    Product : ZXX
    Text : BTE Products for FI Exit
    Product active : tick checkbox.
    Call SE37 for exit function and copy from FM SAMPLE_PROCESS_00001110 to ZFI_PROCESS_00001110. Then active your FM and go to FIBF transaction again.
    FIBF -> Settings -> Process Modules -> ...of a customer
    Define a new line.
    Process : 00001120
    Function Module : ZFI_PROCESS_00001110
    Product : ZFI
    And then you can some write ABAP code for validation and give warning message.
    In this FM, If you don't want to check duplicate invoice for your cases you can set export parameter e_nostd = 'X'.
    I hope it helps to you,
    Regards,
    Burak

  • Urgent: Validation For Duplicate Record

    Hi,
    I Have a Simple Tabular Form for Emp,
    (Number Of Records Display = 10)
    I'm Inserting rows like
    Empno Ename Sal Deptno
    1 ABC 10000 10
    2 XYZ 20000 10
    3 XXX 25000 10
    4 YYY 30000 10
    1--- Err
    If I again try to insert 1 then the system should give message 1 is already exist
    before I save the Transaction.
    Note: This validation should be when the item validate.
    Thanks In Advance
    Ahmed.

    Hi ,
    This topic is discussed and code is available somewhere in this forum , but if you cant spend time take this this will be handy, u have to call this procedure and make slight change in the procedure where it will give a error at the time of compilation , the output coloum called out will return values based on that u can know whether its a duplicate coloum, if any more doubts reply to [email protected]
    PROCEDURE check_dupitem (item VARCHAR2, prod VARCHAR2, dup OUT VARCHAR2)
    IS
    drno NUMBER;
    BEGIN
    :GLOBAL.itr := 'Y';
    IF :SYSTEM.cursor_record = '1' AND :SYSTEM.last_record = 'TRUE'
    THEN
    :GLOBAL.itr := 'N';
    ELSE
    drno := :SYSTEM.cursor_record;
    dup := 'N';
    first_record;
    LOOP
    IF TO_CHAR (drno) != :SYSTEM.cursor_record
    THEN
    /* the next line you have to change to your item */
    IF item = :tixd_itemcode AND prod = NVL (:tixd_prodcode, '0')
    THEN
    message ('Duplicate Item! Enter a Valid Item!');
    dup := 'Y';
    EXIT;
    END IF;
    IF :SYSTEM.last_record = 'TRUE'
    THEN
    EXIT;
    END IF;
    END IF;
    down;
    END LOOP;
    go_record (TO_CHAR (drno));
    :GLOBAL.itr := 'N';
    END IF;
    END;
    regards
    Rajesh
    Hi,
    I Have a Simple Tabular Form for Emp,
    (Number Of Records Display = 10)
    I'm Inserting rows like
    Empno Ename Sal Deptno
    1 ABC 10000 10
    2 XYZ 20000 10
    3 XXX 25000 10
    4 YYY 30000 10
    1--- Err
    If I again try to insert 1 then the system should give message 1 is already exist
    before I save the Transaction.
    Note: This validation should be when the item validate.
    Thanks In Advance
    Ahmed.

  • FMs to Check for Duplicate FI Invoices

    Std FMs to check whether a FI invoice is parked or posted.

    Hi
    Use the FM:
    FI_DUPLICATE_INVOICE_CHECK
    Regards,
    Sreeram

  • Problem in Set Check for Duplicate Invoices

    Hi,
    I have did all the required setting s for check duplicate invoice , but when i do miro , its not giving any error or warning msge.. i did all the config  as per blw link..
    FYI-  in migo, i have entered the 3434 as a invoice ref # in delveriy note column and while doing miro , i have entered 3434 in ref column and give the 3434 as a dlvery note # in item tab .. but its not giving any error?
    Pls guide, where the mistake has gone wrongly??
    Problem in Set Check for Duplicate Invoices
    Edited by: UJ on May 15, 2009 1:45 PM

    Hello,
    Hope you have done all the required configurations for the checking of double invoice and ticked the vendor for the double invoice checking in vendor master record.
    You have to understand the way the system does the double invoice check.
    As per the configuration, if the system identifies an invoice for a vendor whose double invoice check is activated, at the time of MIRO, system will update a separate table.
    So system will check for the double invoice entry among the invoices entered after making the tick in the vendor master.
    i meant to say that, if you are introducing this double invoice check in between the transactions, the check will be valid only for the invoices entered after the activation of double invoice check.
    Regards

  • Validation for vendor for invoice Rs.20000

    H expert
    I would like to build a validation for one time vendor for which it should not allow invoice value for <20000
    How to do it. Please suggest me a  step by step config involved in this.Points will be rewarded.
    sk

    Better to write Validation :
    Prereqisit:
    BKPF-LIFNR>=1 AND BKPF-LIFNR<=100
    **Check**
    BSEG-WRBTR
    and Write any Message what you want then SAVE
    Go to OB28 and assign this validatin to our company code and active and SAVE
    I hope this validation useful for you
    If it will useful 4 u give rewards
    Regards
    TML

  • Set Check for Duplicate Invoices.

    Hi,
    what is the difference if is set "<b>Set Check for Duplicate Invoices</b>"
    in MIRO?
    Best regards

    HI,
    This check will prevent incoming invoices being accidentally entered and paid more than once.
    You can choose whether to activate or deactivate the check criteria of company code, reference document number and invoice date for each company code. The more criteria that you activate, the lower the probability of the system finding a duplicate invoice.
    The company code check makes sense if you work with more than one company code.
    Depending on the reference document number entry, the system checks as follows:
    1. If you have entered a reference document number, the system checks whether the invoice matches in the following attributes:
    Company code
    Vendor
    Currency
    Invoice date
    Reference document number
    2. If you have not entered a reference document number, the system
    3. checks whether the invoice matches in the following attributes:
    Company code
    Vendor
    Currency
    Invoice date
    Amount in
    document currency
    Depending on the system settings, a warning message or an error message appears if the system finds an invoice that matches all attributes.
    Requirements
    The field Chk double inv. (Check for duplicate invoice) must be flagged on the Accounting view in the vendor master record.
    Regards
    Aasif

  • Check for duplicate invoices and trigger a workflow

    Hello All,
        I have a requirement to check for duplicate invoices in AP(Accounts payable) and trigger a workflow when duplicate invoices are found. I a not sure how to do any of the above. Please  let me know if you have any information on:
    1) Checking for duplicate invoices in AP
    2) Trigger a workflow
    Are there any standard workflows that checks duplicate invoices?
    Thanks.
    --Mithun

    Hi MD,
    I doubt if system gives an error on FI side when a duplicate invoice is posted.
    I feel you would require a BAdi for it, where you can call your WF using FM SAP_WAPI_START_WORKFLOW.
    Hope it helps.
    Aditya
    P.S also ask your Func Consultants, if there are any settings in the Customization, where you could capture Inv Dt, Inv Amt, Vendor, Company code.
    Edited by: Aditya Varrier on Oct 15, 2008 9:38 AM

  • Configuration Settings for Postal Adress Validation and Duplicate Check

    Hi,
    What are The Configuration settings for Postal adress validation and Duplicate Check for Accounts(BP'S) in CRM 7.0 version
    Can some one send me the configuration settings for Postal Adress validation and Duplicate Check
    Thanks & Regards
    Kishor Kumar

    Hi kishore kumar,
    For the Postal code Validation you need to install and configure the following
    Outside of your SAP system:
    1. Install Data Services and the Address Directories.
    2. Install Data Services Component.
    3. Install the RFC Server.
    On your SAP system:
    4. Install the BAdIs from the previous version of this product.
    5. Install the BAdIs support package from this version.
    6. Run the post-installation tasks required of a new installation of the BAdIs.
    7. Activate the IC WebClient, if desired.     
    Thanks
    Jayakrishnan Nair

  • BTE for Duplicate invoice

    Dear SAP gurus,
    We are on ECC 6.0.  We are trying to use BTE 1110 to build our logic for duplicate invoice.
    We have activated it in FIBF by copying the sample process, but it is not getting triggered while doing any vendor invoice posting.
    Please adv
    Thanks!!

    Refer the below link:-
    [http://wiki.sdn.sap.com/wiki/display/Snippets/BusinessTransactionevents(BTE)]
    Regards,
    SDNer

  • CRR: Need script for Validated, unpaid and unhold invoices

    Hello Friends,
    Kindly give me report to prepare Cash Requirment Report. Which should have validated, unpaid and unhold invoices in the output.
    Thanks in advance.
    Regards,
    Raj
    Below is the my query -- Getting wrong data
    select decode(ia.set_of_books_id ,224,'TGB Australia - Primary SOB'
    ,225,'TGB Australia - Reporting SOB'
    ,446,'TGB Belgium - Primary SOB'
    ,447,'TGB Belgium - Reporting SOB'
    ,324,'TGB Bermuda GBRM SOB'
    ,364,'TGB Bermuda Holding Limited SOB'
    ,306,'TGB Bermuda International Holding SOB'
    ,284,'TGB Bermuda SOB'
    ,45, 'TGB Canada - Primary SOB'
    ,44, 'TGB Canada - Reporting SOB'
    ,244,'TGB Consolidation SOB'
    ,84, 'TGB France - Primary SOB'
    ,85, 'TGB France - Reporting SOB'
    ,70, 'TGB Germany - Primary SOB'
    ,71, 'TGB Germany - Reporting SOB'
    ,168,'TGB Hong Kong - Primary SOB'
    ,169,'TGB Hong Kong - Reporting SOB'
    ,72, 'TGB Italy - Primary SOB'
    ,73, 'TGB Italy - Reporting SOB'
    ,409,'ITXC Corp. - Primary SOB'
    ,408,'ITXC Global SOB'
    ,404,'ITXC Hold - Primary SOB'
    ,405,'ITXC Hold - Reporting SOB'
    ,406,'ITXC Hold 2 - Primary SOB'
    ,407,'ITXC Hold 2 - Reporting SOB'
    ,424,'ITXC IPCO SOB'
    ,170,'TGB Japan - Primary SOB'
    ,171,'TGB Japan - Reporting SOB'
    ,285,'TGB Luxembourg - Primary SOB'
    ,286,'TGB Luxembourg - Reporting SOB'
    ,287,'TGB Luxembourg Holding - Primary SOB'
    ,288,'TGB Luxembourg Holding - Reporting SOB'
    ,289,'TGB Netherlands BV - Primary SOB'
    ,290,'TGB Netherlands BV - Reporting SOB'
    ,304,'TGB Netherlands Holding BV - Primary SOB'
    ,305,'TGB Netherlands Holding BV - Reporting SOB'
    ,172,'TGB Norway - Primary SOB'
    ,173,'TGB Norway - Reporting SOB'
    ,444,'TGB Poland - Primary SOB'
    ,445,'TGB Poland - Reporting SOB'
    ,344,'TGB Puerto Rico SOB'
    ,384,'TGB Singapore - Primary SOB'
    ,385,'TGB Singapore - Reporting SOB'
    ,68, 'TGB Spain - Primary SOB'
    ,69, 'TGB Spain - Reporting SOB'
    ,465,'TVC Teleglobe-VSNL Consolidation'
    ,164,'TGB United Kingdom - Primary SOB'
    ,165,'TGB United Kingdom - Reporting SOB'
    ,265,'TGB USA SOB'
    ,484,'VSNL International SOB (301)'
    ,485,'VSNL America SOB (302)'
    ,486,'VSNL Bermuda SOB'
    ,487,'VSNL Guam SOB'
    ,504,'VSNL Japan Primary SOB'
    ,505,'VSNL Japan Reporting SOB'
    ,506,'VSNL Singapore SOB'
    ,508,'VSNL Hong Kong SOB'
    ,509,'VSNL UK TEL - Primary SOB'
    ,510,'VSNL UK TEL - Reporting SOB'
    ,511,'VSNL France - Primary SOB'
    ,512,'VSNL France - Reporting SOB'
    ,513,'VSNL Netherlands - Primary SOB'
    ,514,'VSNL Netherlands - Reporting SOB'
    ,515,'VSNL Germany - Primary SOB'
    ,516,'VSNL Germany - Reporting SOB'
    ,517,'VSNL Belgium - Primary SOB'
    ,518,'VSNL Belgium - Reporting SOB'
    ,519,'VSNL UK LTD - Primary SOB'
    ,520,'VSNL UK LTD - Reporting SOB'
    ,521,'VSNL Spain - Primary SOB'
    ,522,'VSNL Spain - Reporting SOB'
    ,523,'VSNL Portugal INS - Primary SOB'
    ,524,'VSNL Portugal INS - Reporting SOB'
    ,525,'VSNL Portugal UNI - Primary SOB'
    ,526,'VSNL Portugal UNI - Reporting SOB') Sob_Name
    ,decode(tl.due_days,NULL,to_char(tl.fixed_date,'DD-MON-YYYY')
    ,to_char((inv.due_date),'DD-MON-YYYY')) Due_Date
    ,ib.batch_name
    ,v.segment1 Vendor_Number
    ,v.vendor_name
    ,ia.invoice_num
    ,to_char(ia.invoice_date,'DD-MON-YYYY') Invoice_Date
    ,ia.invoice_currency_code
    ,pos.po_number PO_Number
    ,(inv.amount_remaining) Currency_Invoice_Amount
    ,ia.exchange_rate
    ,round(inv.amount_remaining * nvl(ia.exchange_rate,1),2) USD_Invoice_Amount
    ,ia.description
    ,ia.pay_group_lookup_code
    ,decode(hld.holds_count,NULL,'Yes'
    ,hld.holds_count) Approved
    from (select invoice_id
    ,count(invoice_id) Holds_Count
    from ap_holds_all
    where release_lookup_code is null
    group by invoice_id) hld
    ,(select psa.invoice_id
    ,psa.due_date
    ,psa.gross_amount
    ,psa.amount_remaining
    ,psa.payment_method_lookup_code
    ,psa.payment_status_flag
    from ap_payment_schedules_all psa
    where psa.payment_status_flag in ('N','P')
    and amount_remaining is not null) inv
    ,(select ida.invoice_id
    ,max(po.segment1) po_number
    from po_headers_all po
    ,po_distributions_all pd
    ,ap_invoice_distributions_all ida
    where ida.po_distribution_id = pd.po_distribution_id
    and pd.po_header_id = po.po_header_id
    and ida.po_distribution_id is not null
    group by ida.invoice_id) pos
    ,ap_Terms_Lines tl
    ,ap_terms t
    ,po_vendor_sites_all vsa
    ,ap_batches_all ib
    ,ap_invoices_all ia
    ,po_vendors v
    where ia.vendor_id = v.vendor_id
    and ia.invoice_id = hld.invoice_id
    and ia.terms_id = t.term_id
    and t.term_id = tl.term_id
    and ia.vendor_id = vsa.vendor_id
    and ia.vendor_site_id = vsa.vendor_site_id
    and ia.batch_id = ib.batch_id(+)
    and ia.invoice_id = inv.invoice_id
    and ia.invoice_id = pos.invoice_id(+)
    and ia.invoice_id = decode(vsa.hold_future_payments_flag,'N',decode(vsa.hold_all_payments_flag,'N',inv.invoice_id))
    and inv.amount_remaining != 0
    and (inv.due_date <= &<name="Pay Through Date"
    hint="Please enter a Pay Through Date (eg: 31-MAY-2007)"
    type="string"
    required="yes">
    or tl.fixed_date <= &<name="Pay Through Date"
    hint="Please enter a Pay Through Date (eg: 31-MAY-2007)"
    type="string"
    required="yes">)
    order by (inv.due_date)

    Hello Friends,
    Kindly give me report to prepare Cash Requirment Report. Which should have validated, unpaid and unhold invoices in the output.
    Thanks in advance.
    Regards,
    Raj
    Below is the my query -- Getting wrong data
    select decode(ia.set_of_books_id ,224,'TGB Australia - Primary SOB'
    ,225,'TGB Australia - Reporting SOB'
    ,446,'TGB Belgium - Primary SOB'
    ,447,'TGB Belgium - Reporting SOB'
    ,324,'TGB Bermuda GBRM SOB'
    ,364,'TGB Bermuda Holding Limited SOB'
    ,306,'TGB Bermuda International Holding SOB'
    ,284,'TGB Bermuda SOB'
    ,45, 'TGB Canada - Primary SOB'
    ,44, 'TGB Canada - Reporting SOB'
    ,244,'TGB Consolidation SOB'
    ,84, 'TGB France - Primary SOB'
    ,85, 'TGB France - Reporting SOB'
    ,70, 'TGB Germany - Primary SOB'
    ,71, 'TGB Germany - Reporting SOB'
    ,168,'TGB Hong Kong - Primary SOB'
    ,169,'TGB Hong Kong - Reporting SOB'
    ,72, 'TGB Italy - Primary SOB'
    ,73, 'TGB Italy - Reporting SOB'
    ,409,'ITXC Corp. - Primary SOB'
    ,408,'ITXC Global SOB'
    ,404,'ITXC Hold - Primary SOB'
    ,405,'ITXC Hold - Reporting SOB'
    ,406,'ITXC Hold 2 - Primary SOB'
    ,407,'ITXC Hold 2 - Reporting SOB'
    ,424,'ITXC IPCO SOB'
    ,170,'TGB Japan - Primary SOB'
    ,171,'TGB Japan - Reporting SOB'
    ,285,'TGB Luxembourg - Primary SOB'
    ,286,'TGB Luxembourg - Reporting SOB'
    ,287,'TGB Luxembourg Holding - Primary SOB'
    ,288,'TGB Luxembourg Holding - Reporting SOB'
    ,289,'TGB Netherlands BV - Primary SOB'
    ,290,'TGB Netherlands BV - Reporting SOB'
    ,304,'TGB Netherlands Holding BV - Primary SOB'
    ,305,'TGB Netherlands Holding BV - Reporting SOB'
    ,172,'TGB Norway - Primary SOB'
    ,173,'TGB Norway - Reporting SOB'
    ,444,'TGB Poland - Primary SOB'
    ,445,'TGB Poland - Reporting SOB'
    ,344,'TGB Puerto Rico SOB'
    ,384,'TGB Singapore - Primary SOB'
    ,385,'TGB Singapore - Reporting SOB'
    ,68, 'TGB Spain - Primary SOB'
    ,69, 'TGB Spain - Reporting SOB'
    ,465,'TVC Teleglobe-VSNL Consolidation'
    ,164,'TGB United Kingdom - Primary SOB'
    ,165,'TGB United Kingdom - Reporting SOB'
    ,265,'TGB USA SOB'
    ,484,'VSNL International SOB (301)'
    ,485,'VSNL America SOB (302)'
    ,486,'VSNL Bermuda SOB'
    ,487,'VSNL Guam SOB'
    ,504,'VSNL Japan Primary SOB'
    ,505,'VSNL Japan Reporting SOB'
    ,506,'VSNL Singapore SOB'
    ,508,'VSNL Hong Kong SOB'
    ,509,'VSNL UK TEL - Primary SOB'
    ,510,'VSNL UK TEL - Reporting SOB'
    ,511,'VSNL France - Primary SOB'
    ,512,'VSNL France - Reporting SOB'
    ,513,'VSNL Netherlands - Primary SOB'
    ,514,'VSNL Netherlands - Reporting SOB'
    ,515,'VSNL Germany - Primary SOB'
    ,516,'VSNL Germany - Reporting SOB'
    ,517,'VSNL Belgium - Primary SOB'
    ,518,'VSNL Belgium - Reporting SOB'
    ,519,'VSNL UK LTD - Primary SOB'
    ,520,'VSNL UK LTD - Reporting SOB'
    ,521,'VSNL Spain - Primary SOB'
    ,522,'VSNL Spain - Reporting SOB'
    ,523,'VSNL Portugal INS - Primary SOB'
    ,524,'VSNL Portugal INS - Reporting SOB'
    ,525,'VSNL Portugal UNI - Primary SOB'
    ,526,'VSNL Portugal UNI - Reporting SOB') Sob_Name
    ,decode(tl.due_days,NULL,to_char(tl.fixed_date,'DD-MON-YYYY')
    ,to_char((inv.due_date),'DD-MON-YYYY')) Due_Date
    ,ib.batch_name
    ,v.segment1 Vendor_Number
    ,v.vendor_name
    ,ia.invoice_num
    ,to_char(ia.invoice_date,'DD-MON-YYYY') Invoice_Date
    ,ia.invoice_currency_code
    ,pos.po_number PO_Number
    ,(inv.amount_remaining) Currency_Invoice_Amount
    ,ia.exchange_rate
    ,round(inv.amount_remaining * nvl(ia.exchange_rate,1),2) USD_Invoice_Amount
    ,ia.description
    ,ia.pay_group_lookup_code
    ,decode(hld.holds_count,NULL,'Yes'
    ,hld.holds_count) Approved
    from (select invoice_id
    ,count(invoice_id) Holds_Count
    from ap_holds_all
    where release_lookup_code is null
    group by invoice_id) hld
    ,(select psa.invoice_id
    ,psa.due_date
    ,psa.gross_amount
    ,psa.amount_remaining
    ,psa.payment_method_lookup_code
    ,psa.payment_status_flag
    from ap_payment_schedules_all psa
    where psa.payment_status_flag in ('N','P')
    and amount_remaining is not null) inv
    ,(select ida.invoice_id
    ,max(po.segment1) po_number
    from po_headers_all po
    ,po_distributions_all pd
    ,ap_invoice_distributions_all ida
    where ida.po_distribution_id = pd.po_distribution_id
    and pd.po_header_id = po.po_header_id
    and ida.po_distribution_id is not null
    group by ida.invoice_id) pos
    ,ap_Terms_Lines tl
    ,ap_terms t
    ,po_vendor_sites_all vsa
    ,ap_batches_all ib
    ,ap_invoices_all ia
    ,po_vendors v
    where ia.vendor_id = v.vendor_id
    and ia.invoice_id = hld.invoice_id
    and ia.terms_id = t.term_id
    and t.term_id = tl.term_id
    and ia.vendor_id = vsa.vendor_id
    and ia.vendor_site_id = vsa.vendor_site_id
    and ia.batch_id = ib.batch_id(+)
    and ia.invoice_id = inv.invoice_id
    and ia.invoice_id = pos.invoice_id(+)
    and ia.invoice_id = decode(vsa.hold_future_payments_flag,'N',decode(vsa.hold_all_payments_flag,'N',inv.invoice_id))
    and inv.amount_remaining != 0
    and (inv.due_date <= &<name="Pay Through Date"
    hint="Please enter a Pay Through Date (eg: 31-MAY-2007)"
    type="string"
    required="yes">
    or tl.fixed_date <= &<name="Pay Through Date"
    hint="Please enter a Pay Through Date (eg: 31-MAY-2007)"
    type="string"
    required="yes">)
    order by (inv.due_date)

  • Duplicate vendor Invoice check in FB60

    Hi Experts,
    I want to put the duplicate invoice check while posting the vendor invoice through FB60. I want the system to check the duplicate invoices in combination of the Vendor code and vendor invoice number ( we put the vendor invoice no. in the reference field of FB60 ). How to make this possible. I do not want to make the FI validation for the same. Can you please suggest how to go ahead with this.
    Thanks,
    BABA

    Hi Shailesh,
    phuu, ok, let's start from the beginning then.
    Some theory first:
    you need the validation because the standard check takes the doc.date ito consideration and this is not wanted. And you need the exit from the validation (! not a separate exit! not the original), locate the IF-statements where there is an ELSE option ending with function CUSTOMIZED_MESSAGE. It is up to you what to do here. In the original functoin module, the messages are issued here immediately. It can be an error or a warning, depending on the setting in table T100C. If my understanding is correct,  you always want to see an error message, bt this should be done in the validation, not in the function module. So you should skip the customized_message function call and just issue the messages here as info message regardless of T100C settings. In this case, remove the function call customized_message (as many times as it occurs) and issue the message included directly as an information. Right after the message was issued, set E_RC to 4, infoming the validation that the check has failed. (Note that the customized_message function is only called if the check has failed, so no worry that you always get the message.
    4. Define the exit for the validation
    =========================
    Go to your form pool Z_RGGBR000 (defined in V_T80D) and locate the statement APPEND EXITS. It should appear few times, locate the last occurence.
    Right after that, enter the following:
    exits-name = 'U901' .
    exits-param = c_exit_param_none.
    exits-title = text-901.
    append exits.
    This will define a new exit namd U901 for the validation routines. If in V_T80D, you already had a Z (or Y) report, check if the string U901 is used in that code already (check for the main program). If this is the case, instead of U901, use another name, it should begin with U followed by 3 digits. Also, you make sure the text symbol text-901 (or the 3 digits you are using) is existing, doubleclick it and enter a description like "Duplicate invoice check validation" or similar.
    Well, the exit is published, we have to write the main code now.
    go to the very end of your Z_RGGBR000 report and add a new form U901 like follows:
    Duplicate invoice check validation
    FORM U901 USING B_RESULT.
    Vendor master flag
    data: l_reprf like lfb1-reprf.
    Result of function module
    data: l_rc like sy-subrc.
    Check vendor master first
    select single reprf into l_reprf from lfb1 where bukrs = bkpf-bukrs and lifnr = bseg-lifnr.
    Do not continue if flag is not set.
    if L_REPRF is initial.
      b_result = b_true.
    endif.
    check not L_reprf is initial.
    Call modified function module
    CALL FUNCTION 'Z.....your function'
        EXPORTING
          i_bukrs = bkpf-bukrs
          i_lifnr = bseg-lifnr
          i_waers = bkpf-waers
          i_bldat = bkpf-bldat
          i_xblnr = bkpf-xblnr
          i_wrbtr = bseg-wrbtr
          i_koart = bseg-koart
          i_reprf = L_reprf
          i_shkzg = bseg-shkzg
          i_xumsw = bseg-xumsw
          i_bstat = bkpf-bstat
          i_belnr = bseg-belnr                                 
          i_gjahr = bkpf-gjahr                          
          i_blart = bkpf-blart
    EXPORTING
          e_rc = L_RC.                                
    Decide if validation message must be issued or not
    if L_RC = 4.
      b_result = b_false.
    else.
      b_result = b_true.
    endif.
    endform.
    After this, activate the source code. Make sure you have defined the text-symbol 901 before!
    5. Define the validation
    =================
    Go to OB28 now, and enter your company code(s) and the call-up point 002 (line item). If there is a validation defined already, you have to add a new step only, if not, you have to create the validation anew.
    I assume there is no validation defined yet, so enter a name for the validation like FI_2 or similar. It should NOT be named DUPLIC or similar, i.e., you should not include the purpose in the validation name. This is because the validation is defined on company code / call-up point level and it may contain many steps for different purposes later. A generic name FI-2 or probably your company code followed by 2 (2 is the call-up point) is the best choice.
    Before presing enter go to the last column Validatin active and enter 1 here.
    Then press enter and you will get an error that the validation does not exist. No problem, go to menu path Environment --> Validation and let's create a new validation.
    First, enter a description for your new validation in the right hand panel. Again, this should be a generic description, tell nothing about duplicate invoice checks here.
    You may be asked here to assign a message class to the boolean class 009. You should enter here a Z message class where the validation message should be issued from. If no appropriate message class exits, open a new session go to SE91, enter a new message class Z... press create, enter a description. Then go to the Messages tab there, and create a new message with number 001 (NOT 000) and enter the message text there. E.g. Duplicate entry not allowed.
    Coming back to the validation, if the message class was already assigned (this is the case if there was a validation defined earlier), you can create a new step. In case of a new validation, it will become the first step. But if there was already a validation in OB28 for your company code and call-up point 2, then it will be the last step. In the left hand panel, make sure the new (or existing) validation is selected and press the Create Step button (Ctrl-Shift-F5).
    In the right hand panel, enter a description for your step. This is the point where you can enter Double invoice check or similar.
    We have three parts here, a Prerequisite and a Check part, finally a message.
    In the left hand panel, select the Prerequiste. This will activate that screen block in the right side. We have to make sure that our validation is called only for the relevant vendor line items, so press Ctrl-F3 to hange to expert mode ) and enter the following in the Prerequiste window in the right hand panel:
    BSEG-LIFNR <> '' AND BSEG-XUMSW = 'X' AND BSEG-KOART = 'K' AND
    BKPF-BSTAT = ''
    Beware '' is a ' followed by another ' and not a single " !!
    Then switch back to normal mode using Ctrl-F1 and check the small lamp below that should be green now. Also, you can see the field descriptions now. If the lamp is red, press Ctrl-F3 again, delete all and copy the above again. Do not bother with line breaks. Switch to Ctrl-F1 again until the lamp is green. OK, what we have told here was please call the validation only if we have a vendor number and if this is a sales relevant item (invoice or credit memo, but not a payment or similar, this is the standard logic as well), and the account type is vendor (K) and this is a normal document.
    WHen you are done here and the lamp is green, then go to the left side again and select the Check part. Now you should be able to edit the Check screen lock in the right hand side again. Switch to expert mode and enter simply U901
    This is the name of the form in your Z_RGGBR000 report. NO brackets, no spaces, only U901 here. Switch back to Ctrl-F1 and instead of U901, you should see the text of your form (text symbol 901 in report Z_RGGBR000).
    Finally, click the Message part in the left side to be able to maintain the message in the right side. If you issued an error from the function module already, you can give here an information, or you can give it as an error if you like. The message number is one of the messages from your Z message class, you have to define the text in SE91 (see above).
    When done, save the validation and you can test it immediately.
    Here a brief summary what is happening:
    OB28 setting defines that in your company code a validation like FI-2 or similar is active on line item level. Whenever a line item is abut to be created, the validation will be called.
    However, the prerequisite of the validation is quite strict: only a limited number or vendor items will allow to continue, other line items (G/L, customer, not sales relevant vndor, etc.) will just skip the whole validation.
    If the prerequsite was met, the Check part is carried out. Here we have the exit U901.
    In the exit, first we check if the vendor is flagged for double invoie checks. If not, we quit and processing can be continued. B_TRUE means it is OK. If the vendor is flagged, we call the new Z function which is almost the same as the original one.
    The Z function will check table BSIP, but it will skip the document date comparison. If the current invoice seems to be entered earlier (regardless of the doc.date), instead of the standard customized message (which can be E or W for instance), the very same standard message will be issued as an information. So the user will be informed about the previous document number but the processing won't be stopped. In addition, a return code will be set to 4, meaning check has failed.
    Jumping back to the exit, if the return code is 4, we have to tell the validatin that the check has failed (B_RESULT = B_FALSE), otehrwise we can tell the validation that the check was OK (B_RESULT = B_TRUE).
    Now we are back in the validation, and, depending on B_RESULT, we just continue processing (B_TRUE), or issue an error message from a Z message class (B_FALSE). As the main standard message was isued already from the Z function, the user should know at this stage what the matter is. Your Z message can be a bit generic one, no need to include the vendor number or the previously issued invoice, etc.
    Hope that helps, points welcome
    Csaba

Maybe you are looking for