Sage 100

 View Only
  • 1.  AP Script question

    Posted 11-30-2022 12:24
    HI Folks
       A developer we work with asked the following question and I have no idea on the answer.  Hoping some of the script gurus out there can shed some light.  They are importing AP invoices and updating them.  In one case it failed and wound up with a duplicate entry for the invoice number.   This is the script and the question in on the function of the UpdateCleanup line - basically what does it do.   And of course any thoughts on this would be welcome.  

      apInvoiceRegister.nInitReportEngine();
      apInvoiceRegister.nProcessReport("deferred");
      apInvoiceRegister.nUpdateInit();
      apInvoiceRegister.nUpdateMain();
      apInvoiceRegister.nUpdateCleanup();
    ​


    ------------------------------
    Bob Osborn
    Consultant
    ACI Consulting
    ------------------------------


  • 2.  RE: AP Script question

    Posted 12-01-2022 12:50
    Edited by Alnoor Cassim 12-01-2022 14:25
    Bob - The UpdateCleanup method is for clean-up of temporary things and can vary by the _upd program. One reason is to remove the restart key which was maintained with the current document no throughout the update. Another is to clear out temporary posting work files. It varies by _upd class but what's interesting is that AP_InvoiceRegister_upd itself doesn't have a UpdateCleanup() method, so I'm not sure if the script needs it. Also, looks like to handle that so your script won't get an error, the main UpdateCleanup in Sy_Update always returns a "success". So the cause of your duplicates is something else like an interrupted update, as David suggested.

    Also, as you may know, when you manually do an AP invoice and key in a duplicate number, you're prompted by the system on whether to reject the dupe or do an adjustment. But in code, it always defaults to an adjustment (which is why you see the ubiquitous Perform Logic for VI import into AP Invoices to reject the dupe (by yours truly)). So maybe the dupe you're seeing is actually an adjustment to the original invoice??

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



  • 3.  RE: AP Script question

    Posted 12-01-2022 14:11
    Was a hard error encountered during the first attempt to update the entries resulting in an interrupted register?
    If yes, depending on where the error occurred, it could result in the duplicate invoice when resumed.
    As for what UpdateCleanup() does, in the stock code, it appears to reference a null function that always returns "success".  It might be implemented this way to allow an extra hook for third-party enhancements to use.

    ------------------------------
    David Speck II
    Tennessee Software Solutions
    ------------------------------



  • 4.  RE: AP Script question

    Posted 12-01-2022 21:17

    Hi Alnoor & David

        The company doing this is developing something like Bill.com but they want it to be able to post invoices.  They never really give me any details.  Since everything they do is via scripting they would not know if there was an error.   Makes sense that they wound up with an adjustment if the restart record gets removed.  I will pass along the info.

     

       As always, you guys are awesome!!

     

    Thank you,

     

    Bob Osborn

    ACI Consulting

    p 714.282.0378    Direct 714.439.9467

     

    Bob@ACIconsulting.com

     

     ACISignature1                  

    This communication, including attachments, is confidential and may contain proprietary information intended only for the proposed recipient. Please notify the sender and delete this message if you believe that you have received this message in error or if you are not the proposed recipient. Unauthorized disclosure, copying, or distribution of the information is strictly prohibited.