Skip to Content

Changed version of a PO is not getting deleted

Hi Experts,

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.

Manual process-

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

3. BAPI_TRANSACTION_COMMIT

In the later scenario, the changed version is not deleted, however, in the first scenario , the changed version is deleted.

Please guide me.

Thanks

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Best Answer
    Aug 26, 2015 at 12:05 PM

    I get to know that changed version is not deleted after manual operation but it gets converted to historical version.

    What I would need is -

    1. A way to transfer changes to the active version from changed version.

    2. Convert the changed version to historical version

    Thanks

    Add comment
    10|10000 characters needed characters exceeded

    •         gr_po_class = /sapsrm/cl_pdo_factory_po_adv=>get_instance(

                 EXPORTING

                   iv_header_guid                 = pv_guid  "gs_ac_header-guid " Globally Unique identifier

                   iv_mode                        = 'DISPLAY'    " Process mode of PDO Object Instance

                   iv_process_type                = 'ECPO'    " Business Transaction Type

                   iv_user_id                     = sy-uname "gs_ac_header-changed_by

               ).


          gr_po_class->/sapsrm/if_pdo_bo_po~order(

             CHANGING

               co_message_handler             =  gr_o_msg_cons   " Methods for message handling

           ).


                gr_po_class->/sapsrm/if_pdo_bo_po~complete_po(

                   IMPORTING

                     ro_new_po          = gr_ro_new_po

                   CHANGING

                     co_message_handler = gr_o_msg_cons    " Methods for message handling

                     ).


      Worked for me (obviously exception handling is vital here). The problem got resolved after using complete_po method of PO PDO interface. This deletes the changed version.


      Thanks