Skip to Content
Technical Articles

S/4 Purchase Order Flexible Workflow: ABAP Classes

Hello,

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;

Here:

And here:

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:

IF_SWF_FLEX_IFS_DEF_APPL:

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:

IF_SWF_FLEX_IFS_DEF_APPL

IF_SWF_FLEX_IFS_RUN_APPL

IF_SWF_FLEX_IFS_RUN_APPL_STEP

Because you’ll use them on your custom Flexible Workflow developments and other standard flows.

Enjoy!

Regards.

2 Comments
You must be Logged on to comment or reply to a post.
  • Hello Jose,

    Nice work. Thanks for sharing.

    Could you please let me know, which class will be triggered while we raise the workflow start event(SUBMITTED_FOR_APPROVAL)?

    Actually, I am trying to debug how the workflow will get started when we raise workflow start event.

     

    Thanks in advance.

    Best Regards,

    Jagadeesh Kenguva