To cancel any posted invoices, select ‘Cancel or re-issue Posted Invoices’ from the ‘Accounts Payable’ menu as shown below.
You will then be presented with the following form.
From here you can select which transaction number to cancel as well as choose to either cancel the invoice outright, or re-instate it in an un-posted state so that changes can be made to it.
After you press OK the ledger entries will be made to cancel the invoice as requested.