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.

Reply
  • 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.

Children