Updated: Jul 6, 2022
Usually, after posting the Sales Orders/Purchase Orders, these documents are automatically deleted. In other words, once the Purchase Orders/Sales Orders are completely received/shipped & invoiced, these documents are deleted automatically.
Then, why I have a few Sales Order/Purchase Order still showing up in the system even if they are "completely shipped/received and invoiced"?
Solution (rather Explanation)
The Purchase Orders/Sales Orders are automatically deleted only when it is posted (completely received/shipped & Invoiced) from the document itself using the Post action on the ribbon Bar.
The documents are not deleted when it is invoiced using the Get Receipt Line (in case of Purchase order) & Get Shipment Line function (in case of Sales Order).
This is the reason you can still find the Sales Order/Purchase Order lying on their list page even if they are completely Received/Shipped & Invoiced.
How to delete such documents (SOs/POs) which are not automatically deleted on posting?
For such cases, you can either manually delete the documents one by one using the Delete action on the list or document page.
You can use the Delete Invoiced Sales Orders/ Delete Invoiced Purchase Orders function to delete in bulk.
In any case, a Sales Order can only be deleted if "Shipped but Not Invoiced" is Zero.
In any case, a Purchase Order can only be deleted if "Received but Not Invoiced" is Zero.
Hope it Helps! Cheers!