Sage 100

 View Only
  • 1.  I have a vi job to import ap invoices with the fol

    Posted 07-28-2017 13:21
    I have a vi job to import ap invoices with the following perform logic on it to stop duplicate invoices from importing. Stopped working after and upgrade from Sage 100 advanced 2016 to Sage 100 Premium 2017. CHECK_INVOICE: IF NOT(cInvoiceHistoryHeader) THEN { cInvoiceHistoryHeader=%sys_ss'OpenTable(""AP_InvoiceHistoryHeader"",""COMPANY"") } cInvFound=0 SELECT *,REC=HIST$ FROM cInvoiceHistoryHeader BEGIN IMP$[2] END IMP$[2]+$FE$ IF HIST.VendorNo$=STP(IMP$[1]) THEN LET cInvFound=1 NEXT RECORD IF cInvFound THEN LET IMP$[2]=""DUPLICATE"" RETURN It is assigned to the Before Assign perform type=header; tablename=AP_invoiceHeader; Column Name/invoiceno Any thoughts would be greatly appreciated.


  • 2.  RE: I have a vi job to import ap invoices with the fol

    Posted 07-28-2017 13:53
    Does the use of SQL tables change the logic or syntax needing to be used for this?


  • 3.  RE: I have a vi job to import ap invoices with the fol

    Posted 07-28-2017 23:50
    Tim - Potentially several issues with that version. Suggest trying the version I posted here a while back (below). Premise is to fool the system that an invalid InvoiceNo is being set by exceeding the dict length of 20 (used to be 10). Also using a built-in function to check for existing invoices. Also I don't need to reference the specific column in source file (like IMP$[2]) so that dependency is gone. Just make sure the APDivisionNo is on the Data tab and above the VendorNo. Also the person who I wrote it for reviews the job log afterwards and not only sees the duplicate but also likes seeing the Vendor No + Invoice No as you see below. She also wanted to see Invoice Amt which I did but commented out here. Lastly, since you do scripts you can alternately adapt same logic to Pre-Validate of InvoiceNo script where you run same CheckInvoiceHistory() function below and do SetError if true. But also make sure Left(oSession.StartProgram,2) = ""VI"". ** EDIT ** It occurred to me that since InvoiceNo is part of the key you can't run it on Pre-Validate but maybe it will work on PreWrite. Still run only when: ` Left(oSession.StartProgram,2) = ""VI"" ` This Perform below also goes on the Before Assign of Header on InvoiceNo: ** EDIT ** I made a few changes in the message that appears in the Import Job Log below. ! AP_102VISkipDuplicateInvoices.m4p ! By xkzero - Alnoor Cassim ! 07/21/2015 IF NOT(coInvcHistHdr) { coInvcHistHdr = NEW(""AP_InvoiceHistoryHeader_Svc"",%SYS_SS) } InvoiceNo$ = var$ ! Field value is passed in for us as var$ retExists = coInvcHistHdr'CheckInvoiceHistory(APDivisionNo$, VendorNo$, InvoiceNo$) IF retExists { var$ = ""Duplicate Vendor: "" + VendorNo$ + "" Invc: "" + InvoiceNo$ ! var$+= "" Amt: $"" + IMP$[n] - optionally add InvoiceAmt from source file. Change n to match column number is source file. ! Force dictionary error of length exceeded. Causes Fail entry in Import Job Log. } EXIT


  • 4.  RE: I have a vi job to import ap invoices with the fol

    Posted 08-02-2017 05:53
    Thank Alnoor. Worked well. Interesting thought about using a script. I may play with that in my free time just to see what can be done. Thanks again.