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
------------------------------