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!
cancel
Showing results for 
Search instead for 
Did you mean: 
Elkhawanky
Explorer

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:





  1. Sales Flexible Workflow Introduction for Public Cloud

  2. Environment Setup For Public Cloud

  3. User and Role Authorization

  4. Cloud BAdI Overview for Manage Sales Document Workflows

  5. Create Workflow for Sales

  6. Testing Scenarios.

  7. Useful Apps

  8. Issues and Solution

  9. 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.

  1. 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.













  1. 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: 

  1. 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)

  2. The user also has access to the My Inbox app to see the approval tasks

  3. 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.












Workflow by Teams: 

  1. The user needs the role: SAP_BR_BPC_EXPERT

  2. Launch application Teams and Responsibilities

  3. Choose Category Sales

  4. Define a new team and assign team members



A very nice video to watch: Learn about Responsibility Management.




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.

  1. The user needs the role: SAP_BR_ADMINISTRATOR

  2. Understand the Logic of the BAdI Code

  3. 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.






    1. Go to Custom Logic App.

    2. Create a BAdI copied from the pre-defined (SD_APM_SET_APPROVAL_REASON).

    3. Add your custom logic in the BAdI (check the example code below).

    4. Save and Publish your newly created BAdI.





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

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:



    1. Go to Manage Sales Document Workflow

    2. Select Workflow for Sales Order from the Drop-Down List.

    3. Click Create Button

    4. Add Workflow Name, Description, Validity of Workflow, And Define Conditions.

    5. Add Recipients (Teams or Users) and Rework Cases

    6. 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

*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.










  • 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.

App 1: Flexible Workflow Administrator
Benefits of this app:

  • Display a list of all flexible workflow instances.

  • Filter and sort the displayed flexible workflow instances.

  • Cancel one or several selected flexible workflow instances in one go.

  • Resume one or several selected flexible workflow instances in one go.

  • Forward Workflow to a Secleted CB User.

  • Display detailed information about the flexible workflow instance.

  • Check Step Log.

  • Check the Workflow Log.



 









App 2: Workflow Administrator GUI (t.code: SWIA)
Benefits of this app:

  • Restart a workflow instance.

  • Cancel a workflow instance.

  • Resume stuck workflows.

  • Find invalid user assignments.

  • Forward dialog work items.

  • Configure a substitute for an absent user.

  • Trigger a new determination of the potential processors of a task.




 


8- Issue & Solution:


Issue 1:


Issue 2: 
Issue 3:
Solution: Workflow Trigger Issue Solution: SAP Note



9- Conclusion


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
1 Comment