cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Control triggering of PO approval workflow based on changes to few fields on PO

Former Member
0 Likes
797

Hi All,

We have a requirement to not trigger the PO approval workflow when only the fields final_entry and final_inv (checkboxes) are changed on the PO and trigger it if any other field gets changed including or excluding these fields.  We checked through the config route which yielded no solutions, so now what I am doing is trying to do this via coding. I have put in a logic in the BADI BBP_WFL_APPROV_BADI where I am trying to get all the versions of the PO item using the FM BBP_PD_PO_GETDETAIL and then passing the GUID of the 2 latest versions to the FM BBP_PD_PO_GET_DIFF which gives me the list of field names which were changed. So by discarding some common fields which changes for every run I can check if only the above mentioned fields where changed or if any other fields where also changed. One major flaw in this logic and one which completely renders this useless is that I don't have the current version GUID i.e the GUID for the present run, so I basically cannot compare the versions and so wont get the changed fields list. So if any of you know how to get the GUID for the current version which I can then pass  to the FM BBP_PD_PO_GET_DIFF that would just make my whole code work perfectly. I tried using the BBP_PO_MEMORY_GETbut its not retrieving the version details or the GUID for the current version of the Item. Or if there is any other way of achieving this functionality I would be happy to hear them too. The only other option as I see is to get the current item details (which I get from the FM BBP_PD_PO_GETDETAIL) and compare each field value with the item details from the previous version (which I get from the Diff FM) to check if there any difference or change in the field values. But that would mean checking every field and also for every item.

Please let me know if there is a better way of achieving this.

Thanks,

Vikas

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Likes

Hi Vikas,

Are you using the process control workflow? If you are then you can write the logic to determine the process schema definition. Have multiple process schema ( 1 with your custom logic and 1 with the auto approval process) and trigger it based on your logic that you mentioned above.

And in your above logic which method of the badi are you using? there is a parement called GUID and object_id in the method GET_REMAING_APPROVERS. Are you saying that these fields are empty during runtime?

Regards,

Naveen

Former Member
0 Likes

Hi Naveen,

Thank you for your reply, we are currently in SRM 5 so we do not have process control workflows.

Also I am using GET_REMAING_APPROVERS method for my code and I do use the GUID, but this GUID is for the PO itself and what I am looking for is the item version GUID.  Every time  you change the item it creates an version, comparing this version with the previous one with the FM I have mentioned above would give me the list of fieldnames of the fields changed. But as I have mentioned the problem is with the GUID of the version for the current change, which is unavailable when the BADI is triggered.So if there is a way to get this version GUID then it would make my life very easy, if not I would have to think of an alternate logic.

Regards,

Vikas

Former Member
0 Likes

Hi Vikas,

I dont have Extended classic in my landscape for me to check this. But if you have the GUID can you not pass this guid to BBP_PD_PO_GETDETAIL and get the E_VERSION which will list out all the versions of the PO.

Regards,

Naveen