I agree with Inge and Kim.
Changing the document number of a posted invoice could potentially break a database unless the routine includes further actions like check that the new document number does not exists already, updating document lines and all all related entries.
The hardest part of the job is to update the the G/L - Item Ledger Relation table that holds data about the invoice and the shipments. The G/L entry is linked to value entries that are lined to the ILE table.
Any code developed to change the document number of a posted invoice must update all the entries to maintain traceability and cost applications. If not, any report on customer profitability will return incorrect data.
The job is doable but it's an ugly piece of work.
As a consultant I would not work on any code that touches those tables.
If the requirement is to use different invoice numbers for different customers/ sales types, I suggest developing something different based on the Posting No. Series on the Sales Header.
The option could allow users to choose a No. Series in the Sales Header before posting.