Tuesday, 13 October 2020 13:31

Flexible Workflows: Custom Flexible Workflow Scenario for RE-FX Contract – Part 1

Written by Mohammed Aymen
Rate this item
(0 votes)
“© 2020. SAP SE or an SAP affiliate company. All rights reserved.” “Used with permission of SAP SE”

Introduction

SAP has provided standard flexible workflow scenarios for PO, Sales Orders, PR, Journal entries etc. We are only able to use existing scenarios & customize the workflows based on our conditions. So the problem few of our customers face is that PO & SO approvals are done using flexible scenarios, but for rest of those scenarios which do not have any flexible workflow, they have to go back to old SWDD workflows. Customer wanted all of their workflows to be under same maintenance platform(Flexible workflows).

Solution

Hence we planned to move that older SWDD workflow to a custom flexible workflow scenario. You can use the steps to create custom flexible workflows for any of your own scenarios.

Below are the steps for a custom flexible scenario for RE-FX contract Activation. We will divide the blog post to 4 parts:

  • In this blog post, I will show the setup for creating a custom flexible WF scenario for approval in SWDD_SCENARIO.
  • In Part 2, will discuss how to configure & test the workflow scenario using runtime classes.
  • In Part 3, I will show an alternative method to create flexible workflow scenario & also multi-level approvals.
  • In Part 4, I will explain how to create a consumption value help custom CDS to be used as F4 help for flexible workflow start conditions fields.

Let us begin. The scenario is – when a customer created  a contract using RECN tcode, a workflow is triggered which on approval, activates the contract(status change).

To create a flexible workflow, go to tcode SWDD_SCENARIO.

Create a workflow container for your Object type. It can be a BO or a class. For our example, I am using BO BUS1505. We can also create a custom BO or custom class. Now specify the container created as leading object in flexible block. Flexible blocks are used to set up process data, conditions, rules & all the decision steps or activities.

Process Data

In the workflow start events, specify the object type & event to trigger the workflow.

Fleixble%20block

Flexible block

Control Tab

Next, in the control tab specify callback classes for definition & runtime data. By default, system provides default classes for both. For our purpose I have created a custom class as a subclass of ‘CL_SWF_FLEX_IFS_RUN_APPL_BASE’ as we need to redefine few methods to perform operations after approval. We will discuss on that in the next blog post.

Runtime%20Classes

Runtime Classes

Activities Tab

Moving on, create necessary activities in the Activities tab. For our scenario, we are using one user decision to approve/reject contract activation.

User%20Decision

User Decision

The activities created here are used as steps when configuring a flexible workflow in FLP. Create activity(user decision or activity), click on it and add decision texts. Specify decision task.

Activity%20details

Conditions Tab

In the conditions tab, we specify the start conditions used in flexible workflow. Give Name, Text & description.

Conditions%20tab

Conditions tab

Click on parameter button, and give the name, text & data type.

Parameters

Parameters

Value Helps Tab

The green light icon specifies the search help. We will create the search help in the value help tab & link it here. This is used if we want F4 helps for start condition fields. There are standard value helps available for company code & other fields.

Value%20helps

Value helps

Service Path for value help: /sap/opu/odata/sap/S_MMPURWorkflowVH_CDS

Entity: S_MMPURWorkflowVH

Property: CompanyCode

Tip: When your workflow is ready, and you are creating a flexible workflow instance in Fiori launchpad, you will only have Assignment by role option. You will not able to set individual users as approvers. For assignment by user to be available, we need to fill the people picker in value help tab (as shown in the above image).

For user assignment:

Service Path for value help: /sap/opu/odata/sap/S_MMPURWorkflowVH_CDS

Entity: S_MMPURWorkflowVH

Property: POUser

We can also create custom value helps using CDS, which I will explain in Part-4

Now click the condition button & set up the condition check for start conditions.

Conditions%20Tab

Conditions Tab

Save & activate the workflow.

Now our workflow is ready. In the next part, we will discuss how to configure & test the workflow.

Thank you. ?

Read 68 times

Leave a comment

Make sure you enter all the required information, indicated by an asterisk (*). HTML code is not allowed.