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
p619793
Active Participant
0 Kudos

Great content! Thanks for sharing. Just an observation, would you mind remove tags  like SAP Cloud Platform Workflow or S/4HANA Cloud etc. where this blog post is not applicable? Or better still, mention relevant SAP systems (on-premise only, I guess)?

Best regards,

Sumit

former_member665486
Discoverer
0 Kudos
Good morning Tapas Saia dhukhan

I made a copy of the standard task WS02000471 Release of Purchase Requistion Item, add a precondition "Created by" when doing the respective tests, it shows me this message in the purchase request in the Approval Details tab.

"The steps cannot be loaded. Please try again later. If the problem persists, contact support."

Note: in the My inbox app you can see the purchase request that must be authorized

I remain attentive to your comments
0 Kudos
Hello Tapas,

Great blog! Can you please share the configuration details on how the custom flexible workflow is embedded in PO flexible workflow tab in ME23N, ME22N? Do we have to do any configuration in transaction code - OOCU for PO custom flexible workflow as in OOCU the PO is still pointing to standard WS* workflow? Appreciate your reply.
0 Kudos
Hi Tapas da,

Great document. It is a very good document for starters.
former_member775496
Discoverer
0 Kudos
Hi Tapas,

Well documented.

 

thanks,

Surya
Hello Tapas,

Great document!

I am however not able to achieve the same requirement in Overall release for PR. After I deactivate the standard scenario and activate the custom scenario from SPRO, I am unable to see any of the two scenario in Manage Workflows for Purchase Requisition FIORI app dropdown button.


 

Could you please provide any suggestion here?

 

Thanks!
0 Kudos
Hello tapas.sadhukhan,

Greate one.. I am facing an issue, can you please help me..

 

I have created a custom flexible workflow and the scenario is also active.

Now using Manage Workflows fiori app tried to configure it, but unfortunatly none of the scenarios are getting listed. The system shows a message "There are no Scenarios available'.

Can you please help if we have missed any cofig..

 

Regards,

Anil
shindechaitanya15
Discoverer
0 Kudos
Hi,

This dropdown is controlled by filter assigned in the Target Mapping of the Fiori Tile. Please add your custom workflow WS9XXXXX to the filter value in Parameters.

Check SAP Note 3196177 for more reference.

Best Regards,

Chaitanya Shinde
tgdfudi1
Explorer

Copying the Flexible Sales Workflow WS02000447


I sucessfully copied the Standard workflow.

What I haven't found out yet is that in the Agent Rules tab, the two Display Assigned Responsibility Rules, Sales Document Approver - Level 1 and 2 are no longer visible in the copy. Where can you assign them to the copied workflow? Didn't find anything in customizing?

Thanks for help!
atulsaini
Explorer
0 Kudos
Facing same issue. Because Assigned Responsibility Rules are not copied to the custom workflow scenario, the new workflow scenario is not activated. Did you find any resolution for this?
tgdfudi1
Explorer
0 Kudos
I'm currently in conversation with one from SAP on this topic. If I know more, I'm happy to post it here. In my opinion, it is very disappointing when SAP note no. 2924996 under point 7 states that the standard scenario should be copied if necessary, but then nowhere is it described how to do this. This differs significantly from the classic workflow and therefore a detailed description is necessary here. All of our experts were at a loss. The blogs often address relatively simple problems. When it comes to difficult questions, usually no one knows what to do. A shame.
0 Kudos
Assigned Responsibility Rules are not getting copied to custom workflow scenario from standard. any resolution for this issue?
bajwakool7
Explorer
0 Kudos
Hello Tapas,

Great Blog! It helped me to create my first custom Flexible workflow by copying standard scheduling Agreement Flexible workflow WS00800305.

Just want to add one thing, the standard Tasks (like TS00800580, TS00800530 etc.) will not work in My Inbox, unless we implement BADI /IWWRK/BADI_WF_BEFORE_UPD_IB and filter it for the WS9* and related step.

 

Regards,

Kulwinder Singh
Labels in this area