Skip duplicate import record if invoice is in history

Running Sage 100 v2018.  Created a VI import into AP_InvoiceHeader/Detail in order to populate invoices into AP Invoice Entry.  I have a Perform that checks to see if there are duplicates in the AP_InvoiceHistoryHeader table:

-------------------------------------------------------------------------

ENTRY_POINT:
IF NOT(coInvcHistHdr) THEN {
coInvcHistHdr = NEW("AP_InvoiceHistoryHeader_Svc",%SYS_SS)
}

InvoiceNo$ = VAR$

retExists =coInvcHistHdr'CheckInvoiceHistory(APDivisionNo$, VendorNo$, InvoiceNo$)

IF retExists THEN { VAR$=$$ }

EXIT

--------------------------------------------------------------------------

This perform works great!  However, I would like to add a fourth validation for InvoiceDate$.  I must be missing something because when I add ", InvoiceDate$ to the end of the "retExists..." line, I end up with an Error 36 on the same line.  If I replace the "InvoiceDate$ with a different validation field (say replacing VendorNo$ with InvoiceDate$) I don't get the error...only when I'm adding a fourth validation.  It's got to be something I'm overlooking but can't seem to find it.

Parents
  • I personally think you are opening a can of worms if you start accepting duplicate invoice numbers.  Sage will combine all invoices duplicates together under the original number.  Your visibility will be limited to drilling down into the record.  Historical queries become more difficult as you now have to deal with the sequence number linkage.  I know there are situations where the vendor sends the same invoice month after month.  My work around to that is to include a differentiator to make it unique (Oct2021, Nov2021, SLSTX_103121, SLSTX_113021, STMT_0421, STMT_0521, etc).  Over the past 20 years, I have found that even if you CAN do it, is it wise to do?  It just complicates downstream report writing.

  • in reply to btmlinesoft

    Thank you for the input, btmlinesoft.  At the root of the situation is the client wanting to make sure they don't accidently import the same batch twice during the invoice import process since the import happens twice daily.  The addition of the Date argument was suggested to make sure individual invoices were not duplicates.

  • in reply to Paul Smith - Bretthauer

    I header pre-write script (with SetError) should be able to do that kind of filter... using whatever business logic you wish for the filter, assuming you can write the script.

  • in reply to Kevin M

    Thank you, Kevin.  I talked with the client and I think we're keeping with the existing functionality instead of adding the 4th arguement.

Reply Children
No Data