Skip to Content
User Experience Insights
Author's profile photo Celine Deng

How to Dynamically Determine Approver Based on Partner Function for Sales Document Workflows

In approval workflows for sales documents, you can assign the approver by user or by role. Based on your settings, the system determines the approver as follows:

  • Option 1: By user

The approver is the designated user in the Manage Sales Document Workflows app.

  • Option 2: By role (requiring predefined team member function)

The approver is the user that has been assigned to a particular team member function (for                  example, “Sales Document Approver – Level 1”) in the Manage Teams and Responsibilities app.

  • Option 3: By role (requiring predefined custom responsibility rule and responsibility context)

The approver is a user dynamically determined for a particular partner function in a sales document.

This blog focuses on option 3 and describes how to dynamically determine the approver based on partner function (taking the approval workflow for sales quotations and partner function VE as an example).

 

Process Overview

A. Define a BAdI implementation in the Custom Logic

B. Create a custom responsibility rule in the Manage Responsibility Rules

C. Create a custom responsibility context in the Manage Responsibility Context

D. Define a sales quotation workflow in the Manage Sales Document Workflows

 

Step-by-Step Guide

A. Defining BAdI Implementation (Custom Logic App)

  1. Create a BAdI implementation (BAdI filter value: YY1_Partner) for the business context Responsibility Rule.

         

  1. Write custom logic that fulfill your business requirements.

In this example, the custom logic specifies the sales employee as the approver. If the partner function VE (sales employee) exists in a document, the system will get its user ID and assign the user as the approver.

B. Creating Custom Responsibility Rule (Manage Responsibility Rules App)

  1. Create a custom responsibility rule “YY1_PARTNER”.

Note: The rule ID must be the same as the BAdI filter value (defined in step A).

  1. Specify the data source for the rule parameter (Type: table, CDS view: I_SALESDOCUMENTPARTNER)

During approver determination, the BAdI implementation will call the parameter and access the table that contains partner function data in the document header.

C. Creating Custom Responsibility Context (Manage Responsibility Contexts App)

  1. Extend the standard responsibility context (“WS02000447”) for the sales quotation workflow.

  1. Create an agent rule.

a. Map the agent rule to the responsibility rule “YY1_PARTNER” (defined in step B).

b. Specify the data source for the rule parameter.

In this example, the “PARTNER” association of the CDS view I_SalesQuotation is used as the data source. During approver determination, the BAdI implementation will call the parameter and access partner function data in the sales quotation header.

D. Creating Sales Quotation Workflow (Manage Sales Document Workflows App)

When specifying recipients for your workflow, choose assignment by role and set the agent rule (defined in step C) as the role.

Results

In the header data of a new sales quotation, partner function VE (sales employee) exists and the related user is “Example InternalSalesRep”.

An approval workflow has been triggered for the sales quotation. In approval details, the approver is determined as “Example InternalSalesRep” (based on partner function VE).

User “Example InternalSalesRep” receives a workflow task in the My Inbox app.

 

References

How to Set Up Approval Workflows in Your System

Custom Logic

Creating Custom Responsibility Rules

Extending Responsibility Contexts

 

Assigned Tags

      Be the first to leave a comment
      You must be Logged on to comment or reply to a post.