Skip to Content
Technical Articles

Flexible Workflow: Custom Flexible Scenario – Part 2


In the previous blog(Part 1), we created a custom flexible scenario & created the required activities & conditions. In this blog, we will configure & test the scenario.



Go to the control tab of the flexible block. Double click on the runtime class created.


Runtime Class

Based on your requirement, you can use the class methods available to call the code to perform the operation on approval. I have used the method result_callback, which on completion of approve/reject, does the necessary operations.

In the method result callback, I have written a piece of code to change the status of the workflow from created to activated.


Data: ls_por type sibflpor.
Data(ls_result) = io_result->get_result( ).
DATA(lo_cont) = io_context->get_workflow_container( ).

Move-corresponding io_context->get_leading_object_reference( ) to ls_por.
If ls_result-nature = ‘POSITIVE’.

**write your operation code here


The structure LS_POR contains the Object key, in this case the company code & Contract number.

The structure LS_RESULT contains the step response of Approve/Reject.  Approve is positive & Reject is negative.

The structure LO_CONT contains the workflow container values.


Workflow Trigger

Once all this is step up, you need to call the workflow using SAP_WAPI_CREATE_EVENT FM.

Find a Exit or BADI based on whichever scenario you are working on. I used BADI_RECN_CONTRACT. On save of the contract, I called the workflow trigger method in the BADI implementation



Workflow Trigger

Note: This will only trigger the workflow if there is a workflow created in manage workflow app & it meets the conditions specified.


Configuration & Testing

Now, the workflow is active & trigger is in place. Next, let us test it.

Before we test it, there are 2 things we need to have.

  1. Make sure the user who creates new workflow in the scenario has S_WFFLXDEF authorization object assigned.
  2. Add the catalog tile SAP_BASIS_TCR_T to the user. This will provide you with the Manage workflow App tile. It will show the custom workflow created along with all the other existing ones in the list.


Manage Workflow App

The one I created is RE-FX Contract Activation.


Tip: You can also create your own Fiori tile for workflows. Below screenshot will give you an idea on creating a separate Fiori tile for your workflows. You can copy the same details as below. You just have to change the scenario ID to your custom workfow ID



Fiori tile configuration for flex workflow



custom flexible workflow tile


Note: If you cannot find the scenario, then go to the below path in SPRO and make sure your scenario is activated.

SAP Netweaver->Application Server->Business Management->SAP Business workflow->Flexible Workflow->Scenario Activation


Now your workflow is all set.  Go to your scenario in Fiori launchpad tile, add a new workflow. Give start conditions, add the step and activate.


Start Conditions


Step Sequences and User Assignment


Create a contract in SAP and test it.






We have successfully created & tested a custom flexible workflow from scratch. I hope this will give you an idea on how to create a custom workflow for your requirements. There are further more possibilities with regards to flexible workflow. Hopefully will cover more of those in future blogs.

Thank you 🙂

You must be Logged on to comment or reply to a post.
  • Hi Aymen,

    Nice blog with detail steps, but in the initial Screen shots you have mentioned BUS1505 but in the BADI, under Fm SA_WAPI_CREATE_EVENT you have mentioned ZBUS1505 and Event - ZCREATED, please confirm if we need to create Custom BO. I am trying to create similar workflow for Debit Memo Approval  and using standard BO - BUS2096 but it gives error -SAP node type for leading object could not found (BO BUS2096) when i try to test it from Workflow Builder.

    • Hello Quamer,

      Thanks for the feedback. You do not need a custom BO unless you are using a custom event or method in the workflow. I have changed the FM code in the blogpost. Thanks for pointing it out.


      Now, coming to your error, it is because you did not maintain a Leading Object. Create a container using your BO as BOR Object and add that in the leading object.  Now activate your workflow & it should work fine.



    • Hello Anish,

      As of now, we do not have an option to create custom Team Category in SPRO which can be mapped to Responsibility Management for custom workflows. There are only standard ones available.

      So for now the only options available is Role & User based Agent assignment.