S/4 Purchase Order Flexible Workflow: ABAP Classes
As discussed on my previous post (here), the Purchase Order approval Flexible Scenario (SWDD_SCENARIO) is: WS00800238:
Inside, you’ll see the 3 main ABAP classes that helps orchestrate the Flow:
CL_MM_PUR_WF_OBJECT_PO: The main “Business Object” class, as the flexible standard Workflow does not use the BOR BUS2012 anymore;
CL_MM_PUR_PO_FLEX_WFL: Responsible for the Definitions;
CL_MM_PUR_WF_FLEX_DEF: Responsible for the Runtime;
The CL_MM_PUR_WF_OBJECT_PO class, uses the classical IF_WORKFLOW interface to manage the Workflow Events, Data, etc:
Events (not the BUS2012 Events, like RELEASESTEPCREATED anymore…):
If you’ve noticed, if you want to Cancel a Workflow for a particular PO just use the WITHDRAWN_FROM_APPROVAL event.
Now going to the CL_MM_PUR_WF_FLEX_DEF class:
Notice the ON_VALIDATION_CALLBACK method:
Where conditions are checked.
Now go to the CL_MM_PUR_WF_FLEX_DEF class:
IF_SWF_FLEX_IFS_RUN_APPL and IF_SWF_FLEX_IFS_RUN_APPL_STEP.
This class is really interesting to explore, but notice the RESULT_CALLBACK method:
He is called when the Workflow is Completed (Auto Approval, Approved or Rejected):
Here is where all the magic happens for the particular PO, like the Release/Reject Procedure:
In here you can find some key source code for your custom scenarios.
So as you can see, it does not use the BOR BUS2012 methods anymore, even on the Release Procedure.
You should explore the interfaces classes below as well:
Because you’ll use them on your custom Flexible Workflow developments and other standard flows.