Maximum History Reached in Code & Post Registered Invoices

Credit: Datel

Code & Post Registered Invoices has a database limit on the plreghstm table and can hold 79 rows before displaying the error Maximum History Reached (Even though the field supports 4 characters). The last row holds a ~ (Tilda) in the page number field causing the error message and subsequently the automation routine to fail. Solution is to remove the last 5 or 6 entries in the table so removing the ~001 (Tilda). Although in theory this should be very hard to do some Automation programs such as Datel Automation might not handle some boxes and therefore may fail.

Code and Post Error Message

Recode the invoices if they are incorrect and then remove the last 3 records so it can be re-attempted a few times if something is still wrong.

SELECT * FROM scheme.plreghstm where supplier = '' and item = '' and page_no IN ('|001','}001','~001') order by rowstamp DESC
--Backup table
select * into scheme.plreghstm from scheme.plreghstm
--Do not commit if more records appear to be deleted

BEGIN TRAN
  delete from scheme.plreghstm
    where supplier = '' and item = '' and page_no IN ('|001','}001','~001')
ROLLBACK TRAN
COMMIT TRAN