There is one custom FM changing the purchase order in SRM, it does all the process correctly, however, it does not delete the changed version.
1. A PO is in ordered state and we do change anything in that it creates a changed version. (PO is in Saved status now and it is a change version)
2. After doing the changes, we save the PO and order (auto approval scenario), PO comes in Ordered status and the changed version gets deleted as the Ordered version becomes the only active version of the PO.
Custom FM logic-
1. Update PO with the details using 'BBP_PD_PO_UPDATE' function module
2. Change the PO to Ordered status using 'BBP_PD_PO_STATUS_CHANGE' FM
In the later scenario, the changed version is not deleted, however, in the first scenario , the changed version is deleted.