cancel
Showing results for 
Search instead for 
Did you mean: 

Store data about approver and approved object after flexible workflow approval

KjetilKilhavn
Active Contributor
0 Kudos
129

I have a requirement from our compliance people to log (store) data after approval of purchase requisitions and purchase orders. This will be used to check among other things which documents a person approved if it turns out that person was incorrectly assigned as approver.

Well, that should be easy I said, we just hook on to the change document when the document status changes to approved (define event for change document - transaction SWEC). Famous last words....
That is not quite how it works with flexible workflow where the change of the document being approved (whether it is a purchase requisition or a purchase order) is done by the workflow runtime user SAP_WFRT.

There is in fact no information in the purchase requisition's change documents about who approved the requisition. Creating an event based on the change document is not a solution (or rather, not a very useful solution) and we may as well hang on to the standard event such as CL_MM_PUR_WF_OBJECT_PO event PurchaseOrderApproved.

It looks like I will have to identify the relevant workflow log and read data from the container(s) there. Not exactly what I had hoped for, but I will just have to give it a go .... UNLESS someone here wants to share their idea about an alternative solution approach. SAP S/4HANA 

View Entire Topic
JuanCarlosDelga
Contributor

Hi KKilhavn,

As you said at the end, you need to identify the relevant workflow. A clue, CDS views I_WorkflowTask*

Leading object (your PR), I_WorkflowTaskLeadingApplObj

Result of a step, I_WorkflowStepResult

...

 

Regard

 

 

KjetilKilhavn
Active Contributor
0 Kudos

Thank you for that tip! The view I_WorkflowTaskStartEvent will be very useful for my purpose. It links the start event (Submitted For Approval) to the workflow work item ID. This is of course a much better solution than my old-fashioned plan to use SAP_WAPI_WORKITEMS_TO_OBJECT.