Sage 100

 View Only
Expand all | Collapse all

AP Duplicate invoices during VI Import

  • 1.  AP Duplicate invoices during VI Import

    Posted 07-07-2022 20:18
    Trying to prevent duplicate AP invoices from going through during a VI import. I found a thread on here but it's too old (2019) and it won't let me reply, so I am creating a new one. @David Overholt created the Perform Logic below with the help of @Alnoor Cassim. It is exactly what I need for a customer. However, nothing I do seems to make the PL to work. VI simply ignores it with no errors and imports all duplicate invoices. I setup the PL per Davids remarks below.  I'm wondering if I need to change something for the newer versions of AP. I am testing on Sage100 Standard 2021.3. Any help would be greatly appreciated. 

    David's comments and PL from original thread:

    I just tested my version and it works.  You didn't say what happens. is the perform logic set to run before assign on the field invoice number

    your code looks correct, mine is a little different - I assign "duplicate invoice" to the invoice number so the user can see why it failed, but the logic is the same. below is my code (originally from @Alnoor Cassim)

    ! Prevent duplicate InvoiceNo from being imported into AP_InvoiceHeader
    ! Check AP Invoice History if InvoiceNo already exists for Div and VendorNo
    ! If so, skip to next record

    ! In V/I Import Job set the PERFORM to run on
    ! BEFORE ASSIGN of Header on table AP_InvoiceHeader column InvoiceNo
    ! Command = ..\AP\AP_VISkipDuplicateInvoices.m4p;ENTRY_POINT

    ENTRY_POINT:
    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​​

    ------------------------------
    Kenny Daniel
    TechnoClarity, Inc.
    ------------------------------


  • 2.  RE: AP Duplicate invoices during VI Import

    Posted 07-07-2022 21:11
    Edited by Alnoor Cassim 07-07-2022 21:22
      |   view attached
    Hi @Kenny Daniel - Actually this is something I created a long time ago for various people on 90M, originally for 4.30, then for 4.40+. Probably in the Perform button of your import job something isn't quite set right. It's designed to work on the Before Assign of the InvoiceNo. If the InvoiceNo is found in history then it assigns a very long (therefore invalid) InvoiceNo and because it's part of the key, the whole record will fail while at the same time you'll see the Vendor No it failed for in the job log as well. Attached is a variation of the same Perform file you can use. Place it in your \CM\Script folder. Then set it up based on the screenshot here. If it doesn't work still, take a screenshot yourself of the Perform Maintenance screen, accessed by clicking the Perform button in Import Job Maint. Hope this helps.




    ------------------------------
    Alnoor Cassim

    Email: alnoor.cassim@90minds.com
    Ph:
    ------------------------------

    Attachment(s)

    txt
    AP_Check4DupeInvoice.txt   984 B 1 version


  • 3.  RE: AP Duplicate invoices during VI Import

    Posted 07-08-2022 00:40
    @Alnoor Cassim thank you. I did exactly as you instructed but the PL is still being ignored. It's almost like it's not even there​. I deleted the job and recreated thinking it might help but still nothing. Here is the PL screen of the VI job. Please let me if you see anything wrong or if you have any idea as to why the PL will not kick in. Thank you again



    ------------------------------
    Kenny Daniel
    TechnoClarity, Inc.
    ------------------------------



  • 4.  RE: AP Duplicate invoices during VI Import

    Posted 07-08-2022 01:21
    Kenny - Can I see what's on the Data tab too?

    ------------------------------
    Alnoor Cassim

    Email: alnoor.cassim@90minds.com
    Ph:
    ------------------------------



  • 5.  RE: AP Duplicate invoices during VI Import

    Posted 07-08-2022 01:33
    Alnoor, I think you are on to something. Is it because I'm not importing the InvoiceAmt? The Invoice is being totaled by the distributionAmt on the lines.



    ------------------------------
    Kenny Daniel
    TechnoClarity, Inc.
    ------------------------------



  • 6.  RE: AP Duplicate invoices during VI Import

    Posted 07-08-2022 02:44
    Kenny - I set it up on 2021.2 just like you have it where you're totaling up the Line DistributionAmt's. I tried it on ABC (with batches) and MFG (no batches) and it is correctly preventing duplicate invoices from importing (by failing the InvoiceNo). Can you DFDM AP_InvoiceHistoryHeader and verify you can find one of the invoices you're importing into that should fail as a dupe? That's where the Perform Logic is checking. IOW in A/P Options if you don't have "Track Detailed Invoice/Payment History" enabled, then the Perform has to instead check the InvoiceNo from AP_OpenInvoice or AP_TransactionPaymentHistory

    But if you do find it, then all I can think is something is odd in your source file (maybe extra hidden characters) and in that case I would ask you to upload it or a snippet of it.

    ------------------------------
    Alnoor Cassim

    Email: alnoor.cassim@90minds.com
    Ph:
    ------------------------------



  • 7.  RE: AP Duplicate invoices during VI Import

    Posted 07-08-2022 10:12
    Alnoor - The PL refuses to work on my PC but oddly enough, I copied everything over to the customer side, manually changed the vendors and invoices in the source file and ran a test. It worked the first time. Customer is on Standard 2019. I don't believe the version is the problem. but what do i know. I have no idea why it will not work on my Sage100.  As long as it works for the customer, I'm happy.  If you wish to look further into this, please let me know and I'll provide whatever info you need. As always, your help and support is very much appreciated. Thank you.

    ------------------------------
    Kenny Daniel
    TechnoClarity, Inc.
    ------------------------------



  • 8.  RE: AP Duplicate invoices during VI Import

    Posted 07-11-2022 13:01
    Allow External Access?

    ------------------------------
    Kevin Moyes
    Technical Systems Analyst
    Munjal White Consulting Co.
    ------------------------------



  • 9.  RE: AP Duplicate invoices during VI Import

    Posted 07-11-2022 17:59
    @Kevin Moyes. Unfortunately, not the case. Is it even required for Perform Logic or just Scripting?​​

    ------------------------------
    Kenny Daniel
    TechnoClarity, Inc.
    ------------------------------



  • 10.  RE: AP Duplicate invoices during VI Import

    Posted 07-11-2022 18:05
    Others would know this better than me, but as far as I know all custom BOI access to business objects requires this Allow External Access.  Since the PL opens a new object for the lookup, I was guessing it might be off in the test company you were using.

    ------------------------------
    Kevin Moyes
    Technical Systems Analyst
    Munjal White Consulting Co.
    ------------------------------



  • 11.  RE: AP Duplicate invoices during VI Import

    Posted 07-11-2022 18:10
    Did you try making a reference to the Entry_Point in the PL Command?


    ------------------------------
    Kevin Moyes
    Technical Systems Analyst
    Munjal White Consulting Co.
    ------------------------------



  • 12.  RE: AP Duplicate invoices during VI Import

    Posted 07-12-2022 09:11
    @Kevin Moyes @Alnoor Cassim - I just added the ENTRY_POINT reference but it still allows the duplicates to be imported. What I did discover though is that if I post the duplicate invoice (which will post as an Adjustment), and then run the import again, it will catch the duplicates and prevent them from importing.   ​​

    ------------------------------
    Kenny Daniel
    TechnoClarity, Inc.
    ------------------------------