Dear Friends,
I recently came across a requirement to create Item Version snapshot when the Portfolio Item Status is changed to Approved/Rejected and update the notes tab with approvers Comments. I searched SDN Forum but couldnot find any content for this. I decided to create a small blog to list down the function modules and tables which can be used to meet the requirement.
Solution: To track the Portfolio Item status change I used BADI RPM_PROJ_CUST_FIELDS, Interface method CUST_PROJ_ON_COMMIT_CHANGES.
1. To Create snap Shot: We can use Function Module /RPM/ITEMS_VERS_CREATE_SYNCH which calls method CREATE_ITEMS_VERSION of Class /RPM/CL_ITEM_D_API and subsequently calls function Module /RPM/SAVE_CHANGES to save the version.
We need to pass parameters; Portfolio Item GUID, Version Type (01 for snapshot) and Version Name like 'TEST' to create Snapshot using above function module.
2. To update Notes tab with the Approvers Comments: We need to use Function Module "/RPM/COMMENTS_MODIFY" and Pass the Item Version GUID.
This function Module Internally calls method MODIFY_COMMENTS of class /RPM/CL_OBJECT_API.
Following the function module /RPM/COMMENTS_MODIFY we need to calls function Module /RPM/SAVE_CHANGES to Save the comments.
Feel free to post your queries on this or if you feel that above information is helpful.