
One of the key features of workflow is to enable an organization to automate and streamline their processes, however, sometimes it’s too rigid and do not meet specific business needs. In this blog, we will explore how to create a flexible workflow for Service Quotation that can adapt to changing business requirements.
The flexible workflow is a general function that allows you to define condition-based workflows for approval processes. The functionality is available with CE2302. The flexible workflow for a Service Quotation allows you to define Single Stage Approval Processes for Service Quotation according to your requirements. Approvers can then approve or reject their work items in the app My Inbox. The functionality supported by the approval process includes:
If you are setting up the approval workflow for the first time, there are some prerequisites. We will delve into the details of Prerequisite which includes configuring the agent, custom condition, email template and some initial setup.
Workflow Scenario ID | WS04300018 |
Status Profile | SERVQTWF |
Responsibility Rule | SRV_QTAN_AGENT |
Before we setup the workflow for the first time, there are some steps that may be relevant.
Fig.4
Once the above steps are completed, the status drop down will display the additional Approval Workflow statuses.
Sent for Approval |
Approval Released |
Approval Rejected |
Fig.5(Approval Workflow Status)
Also, the button 'Send for Approval' is enabled if the status of quotation is ‘Open’, ‘Under Review’ and the new assignment block ‘Approval Details’ is visible.
Fig.6(Approval Details Assignment Block and Send for Approval Button)
Customers can implement business logic and associate it with a custom responsibility rule. This association is achieved by keeping the custom responsibility rule ID same as the BAdI filter value.
Fig.13
Select a standard responsibility context id ‘WS04300018’ and choose Extend.Please note that Extend button is only available if it is an extensibility dev system/clientThe Extend button is not available if a standard responsibility context has already been extended ie a standard context can be extended only once.If you want to make any change to an existing context extension, you can edit the context extension.
You navigate to the context details page that might have an assigned team category and standard agent rules.
You can refer the blog for more details, Steps are almost similar with few variation specific to service quotation scenario.
In this example we are trying to determine the Agent Responsible for the Processing the Approval workflow related to Service Quotation that is assigned to Sales Org ‘1710’.
Go to App Custom Logic.
Go to Top right corner of this APP and click on create and choose Business Context as ‘Service Header’.
* condition id - value to be changed
data : ls_condition like line of ct_condition.
data : ls_parameter like line of ct_parameter.
ls_condition-id = 1.
ls_condition-subject = 'Sales Org'.
ls_condition-type = if_swf_flex_ifs_condition_def=>cs_condtype-start_step.
append ls_condition to ct_condition.
ls_parameter-id = 1.
ls_parameter-name = 'Sales Org'.
ls_parameter-xsd_type = if_swf_flex_ifs_condition_def=>cs_xstype-string.
ls_parameter-mandatory = abap_false.
append ls_parameter to ct_parameter.
Fig.23
Defined step condition that needs to be evaluated using BADI SWF_WORKFLOW_CONDITION_EVAL Repeat same steps as above to create the BADI implementation, but this time in BADI description select “Value evaluation of addition conditions for scenarios”. Fig.24
In this badi implementation we will read the value of the condition defined which is Sales Org = 1710 and then check if the Service Quotation Sales Org ID matches with Predefined Condition Sales Org ID, if true then pass CV_IS_TRUE = ‘X’ else false.CV_IS_TRUE is parameter to activate the workflow.
DATA: lv_org TYPE VKORG.
SELECT SINGLE * INTO @DATA(lS_service)
FROM I_ServiceDocumentEnhcd
WHERE ServiceDocument = @is_sap_object_node_type-sont_key_part_1.
IF sy-subrc <> 0.
RAISE EXCEPTION TYPE cx_ble_runtime_error
EXPORTING
previous = NEW cx_swf_flex_lra( textid = cx_swf_flex_lra=>object_instance_not_found ).
ENDIF.
READ TABLE it_parameter_value INTO DATA(ls_param_value) with key name = 'Sales Org'.
IF sy-subrc = 0.
lv_org = ls_param_value-value.
ENDIF.
IF lS_service-SALESORGANIZATION = ls_param_value-value.
cv_is_true = abap_true.
ELSE.
cv_is_true = abap_false.
ENDIF.
Fig.25
Now with all the steps above we will be able to activate the workflow for Service Quotation that is having Sales Org = 1710 assigned.
Flexible Workflow - E-Mail Templates
You want to send an e-mail notification to the requester to let him know whether his request was approved or rejected or send an e-mail notification to the processors of a work item to inform them about a coming deadline violation.
Use Case | Template | Description |
Workflow End | CRMS4_QTAN_APPR_EMAIL_TMPL | At the end of the workflow the workflow initiator shall be informed about the Approval of the approval. |
Workflow End | CRMS4_QTAN_RJCT_EMAIL_TMPL | At the end of the workflow the initiator shall be informed about the Rejection of the approval. |
Step Deadline | CRMS4_QTAN_DLINE_EMAIL_TMPL | When a deadline was reached the step is marked as Overdue. |
Copy the Template in App: Maintain Email Templates.
Fig.26
Manage workflow app for Service Quotation.
By default when the system is set up for the first time, you only have ‘Predelivered workflow Content’ . The Predelivered content is triggered in a scenario when none of the process definitions the start conditions apply for example the scenario that is setup here is to trigger the workflow when the service quotation Sales org is '1710', but if the service quotation does not belong to Sales org '1710' then there is no process definition that start the condition and the default predelivered workflow is triggered which will initiate auto approval.
Now we will create the custom process definition.
Go to App “Manage workflow for Service Quotation” .
The App include the following key features.
Click on Create
Fig.27
Provide some meaningful description and start condition, the only Standard start condition delivered is ‘Service Quotation Type’, User can configure additional Custom Condition like for example ‘Sales Org’ or any use any other custom fields. Please check my next blog detailing the creation of custom condition for approval workflow.
So if the start condition is met the workflow is triggered.
Fig.28
In the next step , we define the steps, here we provide some step name and choose the step type ‘Release of Service Quotation’, The other option to select is ‘Automatic Release of Service Quotation’, this can be selected for Auto Approval Scenario but since we would like to determine the agent that was configured earlier in the steps above, we will go with the option Step type as ‘Release of Service Quotation’ , the Assignment By can Role or User based . If you choose User, the agent can be picked from a F4 help for Role Based the agent is determined based on BADI.
Fig.29
There are several options available that can be explored further.
Next step is to define the deadline, this is to define the action when certain threshold is crossed, it could be to mark step as overdue in MyInbox App or to notify the recipient(workflow Initiator or the Agent) via an email.
Fig.30
Exception handling is like a deadline, but certain actions are triggered which could be processed further in a workflow. With this release no special handling is carried out for each of these exceptions, so user can choose the option to cancel workflow.
Fig.31
The final step is the email notification and we have chosen the 'Initiator of the workflow' to be notified via an email when the workflow is approved or rejected.
Fig.32
It’s important to understand who is the 'Workflow Initiator', well in this parlance the initiator is the person who clicks on send for approval button.
And the final step is to activate the newly created process definition.
Fig.33
It’s a time to test our newly configured workflow, User navigate to app ‘Manage workflow for Service Quotation’, Select one of the quotation in status Open or Under Review and then click on button 'Send for Approval'. This will send the workflow to the agent that is configured above.
Agent can check the triggered workflow in app My Inbox and then can take necessary action like approve, reject. MyInbox app comes up with lots of features like attachment, comments,open task that help agent in taking decisive action.(The comments added in the notes section of service quoation is visible to Agent in MyInbox app).
Fig.34
Voila, you have configured the approval workflow for service quotation.Though the blog has not covered the aspect of the authorization, gateway setting which is beyond the scope of this blog but if you are stuck or facing some technical challenges, please drop your queries/comments. I will try my best to provide the answers.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
19 | |
6 | |
4 | |
3 | |
3 | |
3 | |
3 | |
2 | |
2 | |
2 |