Delete production order

i have a situation of repeating production order no., but it will only happen to a previously existed Finished prod. order.
my plan is to allow deletion of finished produciton order.
to achieve this, i will modify tables:
5405 - Production Order
5406 - Prod. Order Line
5407 - Prod. Order Component
5409 - Prod. Order Routing Line
5410 - Prod. Order Capacity Need

these tables contains code lines to restrict the deletion.
i plan to modify a bit to enable me to delete a finished production order and all related tables.

here what we have in the those tables.

in table 5405:
OnDelete()

IF Status IN [Status::Released,Status::Finished] THEN BEGIN
ItemLedgEntry.SETCURRENTKEY(“Prod. Order No.”);
ItemLedgEntry.SETRANGE(“Prod. Order No.”,“No.”);
IF ItemLedgEntry.FIND(’-’) THEN
ERROR(
Text000,
Status,TABLECAPTION,“No.”,ItemLedgEntry.TABLECAPTION);

I will change:
IF Status = Status::Released THEN BEGIN
//the rest are the same

on table 5406, 5407, 5409:
OnDelete()

IF Status = Status::Finished THEN
ERROR(Text006,Status,TABLECAPTION)

I will change:
{IF Status = Status::Finished THEN
ERROR(Text006,Status,TABLECAPTION)
}
//just put in bracket

In evaluating the effects:
I consider, we have the record in the Item Ledger Entry anyway, in case we need to see the history.
We only can not see the finished prod. order appear when Navigate the entries.

Anyone here has ideas?
Compare to enable renaming the field:“No.” - which is easier to accomplish?

Any comments are highly appreciated.

Thank you.

To delete a production order is a big job,especially it has been posted.

I’ve done once it took me ages to achieve and fixed the problems after blown the prr away, actually there are nearly 31 tables involved

G_L Entry]
G_L Register]
Vendor Ledger Entry]
Posted Approval Entry]
Value Entry]
Warehouse Entry]
Posted Whse_ Receipt Line]
Posted Whse_ Receipt Header]
Purch_ Inv_ Line]
Purch_ Inv_ Header]
Purch_ Rcpt_ Line]
Purch_ Rcpt_ Header]
Item Ledger Entry]
Capacity Ledger Entry]
Production Document Dimension]
Prod_ Order Routing Line]
Prod_ Order Line]
Prod_ Order Component]
Production Order]
Item Register]
Item Entry Relation]
G_L - Item Ledger Relation]
Handled IC Outbox Purch_ Hdr]
Handled IC Outbox Purch_ Line]
Handled IC Outbox Trans_]
Warehouse Activity Header]
Warehouse Activity Line]
Detailed Vendor Ledg_ Entry]
Item Application Entry]
G_L - Item Ledger Relation]
G_L Register]

try to find any of the evidence in these table is not easy

@ Joe

Rather that deleting the record why not rename to a different order number?

@Nyjjack

I think Joe just wants to use the production order number again as opposed to deleting the postings.