Flexible Workflow From Linked in
Flexible Workflow From Linked in
Flexible Workflow From Linked in
Integration
181425,567
1. Background:
It is possible to define single or multi step approval processes, and the relevant
workflow items are made available in the My Inbox Fiori App for the
approvers. Manage Workflows Fiori App is available to configure flexible
workflow scenario, and these apps allow the Business process specialist to set
up workflows based on the business requirement.
New tcode being used to create flexible scenarios in S4 system. Flexible block
is the main component which will play important role in scenario. We have to
first decide all possible decision tasks and activities (background method
executions) as per business requirement. As per our sample workflow, we have
3 decision tasks and 1 activity.
Create one container element employee of class type to hold all employee object
details.
Workflow Element
Go to Header and update start event details. I have created one START event in
custom class which will be used to trigger this WF.
Create all required activities as per business requirement. As per our sample
requirements, we have user decision steps like Level1 Approval, Level 2
Approval, To Requestor and activity like Post Employee data by final approver.
Activites
Create all required Agent rules as per business conditions. For the sake of POC,
I have used one responsibility rule with one agent maintained manually to get
L1 Approver. But in real time scnario, these agents will be determined in FM
based on some roles or any other conditions. That FM being used in PFAC rule.
PFAC Rule
The moment we create activities in Flexible block, it will ask us to provide all
task details for that activity. We need to provide required task details whether
user decision or activity. I’m not going too much here as this is normal
workflow functionality. The moment we create activity, then flow will be
created for this activity. Since we have 4 activities in sample workflow, so we
can see 4 flows visible in this workflow.
5. Workflow Triggering logic (Workflow class logic )
I have declared one public key attribute in this class and instantiated this value
in constructor of the class.
START Event to trigger workflow
Event Parameters
STARTWF method code to trigger this workflow: Below is the sample code to
trigger workflow. In real time situations, you can use your own event
parameters and populatate those. Based on your requirement, we will call this
event in some exits, badis, Odata function imports or create/update methods or
custom programs etc.
Lv_objkey = iv_employee.
CATCH cx_swf_evt_invalid_objtype.
CATCH cx_swf_evt_invalid_event.
ENDTRY.
COMMIT WORK.
Open Manage Workflow app in Fiori launch pad and configure new workflow
based on our custom template. As per our flow, we have 3 steps in workflow,
L1 approval, L2 approval and finally posting data into SAP. When L1 or L2
clicks on Return button , then workitem routed back to Requestor and then
restart workflow when Requestor clicks on Resubmit button. Let us configure
workflow to fulfil this business scenario.
Open our custom scenario in Manage Workflow fiori app and click on + add
button to create new workflow
Valid from and Valid to need to updated if we want to configure workflow for
certain period of time else, leave it blank.
Configure steps. Click on Add in step sequence section and create new step.
Step1 – Level1 Approval
Choose Level1Approver Agent role in receipents. Pls note that these roles are
coming from Agent Rules in Flexi block. So based on our business requirement,
we have to create different rules to determine agents and use those rules in
workflow step configuration.
Generally, we will activate task filter in real time scenario to display ONLY
required workflow tasks work items in My Inbox App. So, unless we add these
in Task settings, new decision tasks won’t be displayed in My Inbox app.
SPRO->SAP Netweaver -> SAP Gateway Service Enablement -> Content ->
Workflow Settings -> Maintain Task Names and Decision Options
Sample Decision Keys for Return to Tequestor task, These desions will be
displayed as buttons in My Inbox App.
Note: These are minimum steps needed to create one custom scenario and
expose it to My inbox app. Let us start testing now.
8. Testing
Login with requestor role and execute test method STARTWF in our workflow
class.
Login fiori launchpad with Level 1 Approver and check the work item in My
Inbox app.
Click on Return button . As per our flow, it will be routed back to requestor.
Click on Resubmit, Workflow will restart again and work item goes to L1
Approver for approval.
From S4 1909 onwards, SAP has provided to enable dead line feature for
decision taks steps in Manage workflow configuration.
As shown below , overdue item was triggered after 10 min and reflected that in
SBWP and My Inbox app of L2 approver.
10. Email Templates
Approve – YY1_(Scenario_ID)_COMPLETE_POSITIVE
Rejected – YY1_(Scenario_ID)_COMPLETE_NEGETIVE
L2 Email Template