Issue with NAS, SELECTLATESTVERSION and table 112


I’ve got a issue with a function. I’ve got a NAS running in intervalls of 60 seconds. One of the things tasks the NAS performs is to check a queue, let’s call it table 70000 which contains any invoice no. available. The NAS then does a SalesInvHead.GET(“Document No.”) to collect the invoice in question and adds the information to a file which is created.

The queue is populated when a user is posting, so at the end of CU80 I’ve got a call to CU70200 by function HandleQueue.AddInvoice(“Invoice No.”).

The issue that I’m having is that some of the invoices that are created in NAV does not get into the file. Is it a possibility that the user posts the invoice and the information (Invoice No.) is added to the queue and in some unfortunate occasions the NAS reads the information from the queue but does not GET the actual invoice from table 112.

The NAS begins it’s run with SELECTLATESTVERSION so in other words the question is if it’s possible that the information in the queue is commited before the information is commited to the table 112?

Are you sure you have all invoice numbers in your 70000 table? I have experienced that code in end of CU 80 that i have added sometimes is not executed if there is some error but still the invoice is posted and committed before the error occured. Thus the invoice number would not be added to the 70000 table.

If you have all the entires in table 70000 still in the table create a simple report to check if some invoice numbers are missing in the 70000 table compared with table 112.

Perhaps try the approach of setting a sent boolean in the 112 table with a new key on it and then every 60 seconds you find all invoices that are not sent and process them.


I recommend to use locktable to be sure that you are reading commited records only…