Flexible Workflow for Sales for Public Cloud - Com...
Enterprise Resource Planning Blogs by Members
Gain new perspectives and knowledge about enterprise resource planning in blog posts from community members. Share your own comments and ERP insights today!
Sales Flexible Workflow in SAP S/4HANA Public Cloud - Complete Guide.
Introduction
In this blog, we'll discuss the step-by-step implementation of S/4HANA Public Cloud Flexible Workflow for Sales, including scenarios.
It's a highly requested feature in SAP S/4HANA Public Cloud, allowing for simplified workflow setup without complex development. Flexible Workflow, part of SAP Business Workflow, covers various lines of business like Finance, Procurement, HR, Manufacturing, and Sales. This blog is your complete guide to Flexible Workflow for Sales in the Public Cloud.
This blog is your complete guide to Flexible Workflow for Sales in the Public Cloud.
I hope you enjoy the Journey.
Blog Agenda:
Flexible Workflow for Sales:
Sales Flexible Workflow Introduction for Public Cloud
Environment Setup For Public Cloud
User and Role Authorization
Cloud BAdI Overview for Manage Sales Document Workflows
Create Workflow for Sales
Testing Scenarios.
Useful Apps
Issues and Solution
Conclusion
1- Sales Flexible Workflow Introduction for Public Cloud:
In certain cases, it can make sense to make sure that a sales document is first approved by a sales manager and C-Level Manager before the internal sales representative or returns and refund clerk can process it further, If everything is fine, the document could be approved and proceed, Our Blog today will show a case of Sales Order Workflow.
2- Environment Setup For Public Cloud:
Before we configure the Workflow, there are a few steps that need to be done by the Key User / System Admin / SAP Public Cloud Business Consultant with Access to CBC, to make sure our process works smoothly.
Create Approval Request Reasons via Configuration Activity [Node ID:102751](Role: SAP_BR_BPC_EXPERT)
Define reasons that are displayed in sales documents or preliminary billing documents to let the business user know why these documents need to be approved.
You must define at least one reason for approval requests to set up the approval workflow for sales documents.
Assign Approval Request Reasons via Configuration Activity [Node ID:102752](Role: SAP_BR_BPC_EXPERT)
Assign the approval request reasons that you have defined to document categories.
Once you have defined approval request reasons, you specify which documents these reasons are valid for by assigning them to one or more document categories.
3- User and Role Authorization:
There are Two Ways to Assign the User to Workflow One Is By User and the Second By Teams, We Will Explain One by One.
Workflow by User:
User needs the role: SAP_BR_SALES_MANAGER (This makes sure that the user is available in the value help of the user assignment in the manage sales document workflow app)
The user also has access to the My Inbox app to see the approval tasks
The user has an Employee Role from the Manage Workforce App
Once you have created the role in the User from the Manage Workforce App, it will be shown in the Maintain Business Partner App with the Personnel Number.
4- Cloud BAdI Overview for Manage Sales Document Workflows:
In this step, we will activate the BAdI which is responsible for activating the Workflow for Sales, this step is done by the SAP Business Consultant / System Admin.
The user needs the role: SAP_BR_ADMINISTRATOR
Understand the Logic of the BAdI Code
Understand the Logic of the Business Need from the Workflow
The above figure provides an overview of the approval workflow, starting with the creation of a sales document.
Go to Custom Logic App.
Create a BAdI copied from the pre-defined (SD_APM_SET_APPROVAL_REASON).
Add your custom logic in the BAdI (check the example code below).
Save and Publish your newly created BAdI.
The above screenshot provides an overview of the BAdI, Check this SAP Help
If document category = C (Order Category)
And Document Type Internal Key = TA (Sales Order Type = OR)
And Sales Organization = 5910
And Approval Reason = ZOR1 (Approval Reason we've created)
=
Starts Sales Workflow
Example Code 1:
*trigger a workflow by setting approval request reason ZOR1.
if salesdocument-sddocumentcategory = 'C' and "Sales Order document category is "C"; Beware Sales Order without charge is "I"
salesdocument-salesdocumenttype = 'TA' and "Internal Key values are available in the Badi (TA and not OR)
salesdocument-salesorganization = '5910'.
salesdocapprovalreason = 'ZOR1'.
return.
endif.
Example of Order Category :
Order Category
Order Category Code
Sales Quotation
B
Sales Contract
G
Sales Order
C
Sales Order Without Charge
I
Customer Return
H
Credit Memo Request
K
Debit Memo Request
L
Example of Internal Key:
Sales Document Type
Internal Key
QT (Quotation)
AG
CR (Credit Memo Request)
G2
DR (Debit Memo Request)
L2
OR (Standard Sales Order)
TA
More Examples:
Example Code 2 for Quotation:
** Example 2: All sales quotations containing a customer with a specific customer abc classification
** shall trigger a workflow by setting approval request reason ZQT1.
*
* data lv_customerabcclassification type if_cmd_validate_customer=>ty_bp_sales-customerabcclassification.
* if salesdocument-sddocumentcategory = 'B'. "Sales quotations
** As the customer abc classification is not availble directly in the importing parameter we need to
** select the customer classification from released CDS view I_CustomerSalesArea
* select single customerabcclassification from i_customersalesarea into @lv_customerabcclassification
* where customer = @salesdocument-soldtoparty and
* salesorganization = @salesdocument-salesorganization and
* distributionchannel = @salesdocument-distributionchannel and
* division = @salesdocument-organizationdivision.
* if lv_customerabcclassification = 'A'.
* salesdocapprovalreason = 'ZQT1'.
* return.
* endif.
* endif.
Example Code 3 for Sales Order with Payment Terms:
** Example 3: All sales orders with order type “Standard Order”, for which the terms of payment have been changed
** from a non-initial value shall trigger a workflow by setting approval request reason ZOR2.
** As you already see here the Example 1 and Example 3 could intersect in conditions.Kindly take care
** of this in the real implementation.
*
* data lv_customerpaymentterms type dzterm.
*
* if salesdocument-sddocumentcategory = 'C'. "Sales Orders
* select single customerpaymentterms from i_salesorder into @lv_customerpaymentterms where salesorder = @salesdocument-salesdocument.
* if lv_customerpaymentterms is not initial and "Check for non-initial
* lv_customerpaymentterms ne salesdocument-customerpaymentterms. "Check for value change
* salesdocapprovalreason = 'ZOR2'.
* return.
* endif.
* endif.
Example Code 4 for Credit Memo Request:
** Example 4: All sales documents of type credit memo request independent of the credit memo request data
** like credit memo request type, sold-to party, order reason, etc. shall trigger a workflow by setting
** approval request reason ZCR1.
*if salesdocument-sddocumentcategory = 'K'. "Credit Memo request
* salesdocapprovalreason = 'ZCR1'.
* return.
*endif.
Example Code 5 for Sales Quotation with Net Value:
** Example 5: A sales quotation which is status "not relevant" could be approval relevance because of some changes;
** like the net amount is decreased signficiantly and the sales manager needs to be made aware of the change.
** Here we have approval process for 2 scenarios. Either incase the sales quotation net amount is greater than
** 10000 EUR or 12000 USD (assuming business is done only in these currencies) or incase the the net value
** reduces by 50%. These cases shall trigger a workflow by setting approval request reason ZQT2 (NetValue related approval)
*
* data lv_totalnetamount like salesdocument-totalnetamount.
* if salesdocument-sddocumentcategory = 'B'. "Sales quotations
* select single totalnetamount from i_salesquotation into @lv_totalnetamount where salesquotation = @salesdocument-salesdocument.
* if sy-subrc = 0.
* if lv_totalnetamount > 0.
* if ( ( lv_totalnetamount - salesdocument-totalnetamount ) / lv_totalnetamount ) * 100 > 50. " Reduced greater than 50%
* salesdocapprovalreason = 'ZQT2'.
* return.
* endif.
* endif.
* else. " New Quotation.
* if ( salesdocument-totalnetamount > 10000 and salesdocument-transactioncurrency = 'EUR' ) or
* ( salesdocument-totalnetamount > 12000 and salesdocument-transactioncurrency = 'USD' ).
* salesdocapprovalreason = 'ZQT2'.
* return.
* endif.
* endif.
* endif.
Code Reference: Public Cloud 2308 BAdI.
5- Setup Flexible Workflow for Sales:
After we finished the configuration of BAdI and made sure the user was already maintained, it's time to finish the last step, which is the Flexible Workflow for Sales.
Steps to Follow:
Go to Manage Sales Document Workflow
Select Workflow for Sales Order from the Drop-Down List.
Click Create Button
Add Workflow Name, Description, Validity of Workflow, And Define Conditions.
Add Recipients (Teams or Users) and Rework Cases
Create and Activate the Workflow
The above screenshot provides an overview of the creation of Sales Order Workflow such as Name and Conditions and Description.
The above screenshot provides an overview of the creation of Step One of the User Assignment.
The above screenshot provides an overview of the Define Action Result for Workflow when the Approver Requests a Rework of the Sales Order.
The above screenshot provides the last step of the Workflow Creation and Activation.
6- Testing Scenarios:
Test Case Scenario:
*Sales Order Creator: CB9980000013
*Level One Approver: CB9980000015
*Responsible of the Rework: CB9980000013
Case 1: Creation of Sales Order.
Case 2: Changing the Sales Order.
Case 3: Checking Notification and Request Rework.
Case 4: Reject the Workflow.
Case 5: Approve the Workflow.
Case 1: Creation of the Sales Order Using the Manage Sales Order Version 2 App
Creation of the Sales Order, After Activating the Workflow.
Once the Sales Order (6) is Saved, the Approval Reason will Appear means the Workflow is Started.
Case 2: Changing the Sales Order from Creator Using: Manage Sales Orders Versions 2 App and from Approver Level One Using: GUI App VA02.
Once the Workflow is Started, No Changes are Allowed.
Case 3: Checking the Notification on the Fiori Home, Check the Sales Order from My Inbox App, Request Rework with Comments Added.
Request Rework for this Workflow Task.
Rework will Trigger the Creator of the Sales Order, with Comments Shown to User, and the Edit Option will be Allowed.
Case 4: The Impact of Rejecting a Sales Order.
Rejecting a Sales Order will Reject all Items with Rejection Reason: Rejected by Approver (77).
Case 5: Approving the Sales Order.
Approved Sales Order Status.
7- Useful Apps:
While I was creating the workflow for Public Cloud, I had to use it to track the process and issues,
This is My Most Useful App I Used for the Workflow.
Flexible workflows in SAP S/4HANA Public Cloud can be customized through the scenarios that can be created and made suitable according to the needs thanks to the BAdI of your processes without hard-coding development. Also, key users can make changes and edit these scenarios without needing developers.