Technology Blogs by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
cancel
Showing results for 
Search instead for 
Did you mean: 

Introduction


In this blog post, you will see how to create and configure a complex Custom Flexible Workflow for Purchase Order approval.

Below is the example scenario:

  • When the Purchase Order is created, it should be sent to the approver’s Fiori inbox for approval

  • If Contract is used in the Purchase Order and if the Purchase Order total amount is equal to Contract total amount, then auto approve the Purchase Order

  • The approval amount limit (we will call it – DOA limit) should be maintained in a custom table.

  • If the first level approver has enough DOA limit, then the workflow ends after the first level approval and the PO is released; If the first level approver does not have enough limit, then the workflow flows to second level approval and so on.


Solution


The following steps are followed to implement the requirement.

  • Create Custom Flexible Workflow

  • Configure Custom Flexible Workflow

    • Scenario Definition

    • Scenario Activation

    • Activate Flexible Workflow for Purchase Orders



  • Agent Determination Rules

    • Creating Rules

    • Include Rules in Custom Flexible Workflow



  • Custom Standard Tasks

    • Create Custom Standard Tasks

    • Include custom Standard Tasks in Flexible Workflow



  • Defining Custom Conditions

  • Defining scenario in the Fiori App


Step#1: Create Custom Flexible Workflow:


To create your own custom flexible workflow for purchase order, copy the standard flexible workflow template number WS00800238.

Activate the event linkage in the Triggering Events tab.



Step#2: Scenario Definition


Define a new scenario for the Custom Flexible workflow in the below mentioned path.

SPRO > SAP NetWeaver > SAP Gateway Service Enablement > Content à Task Gateway > Task Gateway Service à Scenario Definition

Copy the standard scenario “WFL_FOR_PO” in to the custom one.


Select the custom Scenario Definition and double click on the Task Definition for Scenario option in the left pane.



Step#3: Scenario Activation


Activate the scenario defined in the above step. Follow the below path to activate the scenario.

SPRO > SAP NetWeaver > Application Server à Business Management > SAP Business Workflow > Flexible Workflow à Scenario Activation.

Click on New Entries button to add and activate the custom scenario. Deactivate the standard scenario.




Step#4: Activate Flexible Workflow for Purchase Orders


Activate the Flexible Workflow for Purchase Orders based on the document types in the below mentioned path. The flexible workflow will trigger only for the documents type which are maintained in the below mentioned path.

SPRO > Material Management > Purchasing > Purchase Order > Release Procedure for Purchase Orders > Activate Flexible Workflow for Purchase Orders.



Step#5: Creating Rules


Create the custom rules to determine the agents at level 1 and level 2 in transaction PFAC. The below two rules were created based on the function modules. The function modules contain the logic to determine the agents from the custom table.


 

The level 2 agent is called financial approver with DoA limit.



Step#6: Include Rules in Custom Flexible Workflow


The new custom rules can be included in the Flexible workflow as below.

  • Go to SWDD transaction and open the Flexible workflow.





  • Double click on the Approve Purchase Order Scenario task. The following screen open.





  • Go to Rules tab and add the rules that are created in the above step. There would be some standard rules which are already defined. Click on Create button to add the custom rules in that list. Please refer to below screenshot in which the custom rules are added and highlighted.



While adding the rules in the flexible workflow, you can bind elements from workflow container to rule container.


 

Step#7: Create Custom Standard Tasks


This standard task TS90000005 checks the DoA limit of the previous approver.


This standard task TS90000012 compares the PO total value with the Contract total value.



Step# 8: Include custom Standard Tasks in Flexible Workflow



  • Go to SWDD transaction and open the Flexible workflow.





  • Double click on the Approve Purchase Order Scenario task. The following screen open.





  • Go to Activities tab and add the custom standard tasks that are created in the above step. There would be some standard tasks which are already defined for Auto Release and Release of Purchase Order. Click on Create button to add the custom standard tasks in that list. Please refer to below screenshot in which the custom standard tasks are added and highlighted.



While adding the custom standard tasks in the flexible workflow, you can bind elements from workflow container to task container.



Step#9: Defining custom conditions


Custom conditions can be defined in the custom Flexible workflow. The newly created condition can be defined as starting condition. It means it can be defined as Start Condition for the workflow.

  • Go to SWDD transaction and open the Flexible workflow.





  • Double click on the Approve Purchase Order Scenario task. The following screen open.





  • Go to Conditions tab and add the custom conditions here. There are some conditions which are already there. Click on the Create button to add a new condition in the flexible workflow. Give a unique name, Short Text, and Description of the condition.



The highlighted condition is added. The Start Condition checkbox is not checked. Due to this it can not be used as start condition for Flexible workflow. But it can be used as Start Condition for Standard Task execution.


We need to define the parameter for this condition. The value entered on the Fiori screen will be stored in this parameter. Select the condition and click on the Parameter button define the parameter name.


After defining the parameter name, click on the Condition button to define the condition.


In this way, we have defined the multiple conditions which are highlighted below.


 

Step#10: Defining scenario in the Fiori App


Login to the Fiori launchpad. Click on the Manage Workflows app to define the scenario.


 

Click on the Add button to define the Flexible Workflow Scenario. Give the title and description to the scenario. Also provide the validity start date and validity end date to the scenario.


 

Go to Preconditions section to define the start condition.


 

Go to the Step Sequence tab to define the steps. Click on the ADD button to add the step in the workflow.


 

You can also have the pre-conditions added into the Steps. Also assign the rules to the step so that the workitem flows to the actual agent for approval.


 

Similarly, added multiple steps in sequence to define the workflow.



Conclusion


Standard Flexible Workflow are available for use. Should there be a situation where the workflow requirement is complex with various condition at workflow and task levels, varied combination of approval limits and approvers, you can build a quick Custom Flexible Workflow.

Hope you like this blog post.

 

Best Regards,

Tapas Sadhukhan, Technical Architect

&

Sachin Mahajan, Developer
13 Comments
Labels in this area