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.
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.
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.
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 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.
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:
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.
Workflow by Teams:
A very nice video to watch: Learn about Responsibility Management.
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 above figure provides an overview of the approval workflow, starting with the creation of a sales document.
The above screenshot provides an overview of the BAdI, Check this SAP Help
Setup Example: Approval Workflows in Your System.
Business Logic:
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 |
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.
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:
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.
Test Case Scenario:
*Sales Order Creator: CB9980000013
*Level One Approver: CB9980000015
*Responsible of the Rework: CB9980000013
*White Theme = Creator = CB9980000013
*Black Theme = Level One Approver = CB9980000015
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.
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.
Once the Workflow is Started, No Changes are Allowed.
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.
Rejecting a Sales Order will Reject all Items with Rejection Reason: Rejected by Approver (77).
Approved Sales Order Status.
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.
App 1: Flexible Workflow Administrator
Benefits of this app:
App 2: Workflow Administrator GUI (t.code: SWIA)
Benefits of this app:
Issue 1:
Issue 2:
Issue 3:
Solution: Workflow Trigger Issue Solution: SAP Note
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.
Reference Blog: Flexible Workflow in Sales Documents
Thank you for reaching the end of this journey
I really appreciate your lovely feedback.
– Mohamed El Khawanky