Ansicht
Dokumentation

MRM_WF_EXCLUDE_AGENT - Configuration of Agents to be Excluded for Supplier Invoice

MRM_WF_EXCLUDE_AGENT - Configuration of Agents to be Excluded for Supplier Invoice

PERFORM Short Reference   BAL_S_LOG - Application Log: Log header data  
This documentation is copyright by SAP AG.
SAP E-Book

This Business Add-In (BAdI) is used in the Supplier Invoice Workflow Processing (MM-IV-INT-WF) component and is intended to be used in SAP S/4HANA Cloud edition only.

Based on the value of the parameter check_in_myinbox, you can use this BAdI for the following purposes:

  • If check_in_myinbox = false, then the agents excluded will not receive any workitems in their 'My Inbox'.
  • If check_in_myinbox = true, then the agents excluded will not be able to approve or reject the workitem in their 'My Inbox'.

The agents you want to exclude is populated in the parameter EXCLUDEDAGENTS which can hold multiple values.

To differentiate the BAdI implementations, the following filter conditions must be used:

  • WORKFLOWSCENARIO = WS00800251 Workflow for Blocked Invoice
  • WORKFLOWSCENARIO = WS00800303 Workflow for Parked Invoice as Complete

This BAdI provides the interface method: GET_EXCLUDED_AGENTS

Importing Parameters

  • SUPPLIERINVOICE: This parameter provides the Supplier Invoice number.
  • FISCALYEAR: This parameter provides the Fiscal Year of Supplier Invoice.
  • WORKFLOWSCENARIO: This parameter provides information about which workflow scenario is used, as several scenarios can exist for the same business object.
  • PREVIOUSAPPROVERLIST: This parameter provides the approvers of the previous approval steps. If the step needs to be completed by all of the recipients, this provides information only about the last approver.
  • STEPINFO: This parameter provides information about the current workflow step.
  • current_step: Indicates the current workflow step (for example, 001).

  • current_task_type: Indicates whether the current step is an approval step (A) or a rework step (R).

  • total_steps: Indicates the total number of steps of the current workflow (for example, 002).

  • stepdetails: Table with information on all current workflow steps:

- step_number: Indicates the respective step number (for example, 001).
- is_skipped: Indicates whether the step is skipped, that is, whether the step condition applies to it or not (abap_true, abap_false).
- agent_rule_type: Specifies the type of agent rule (FIXED_USERS, BADI_RULE, or AGENT_RULE).
  • CHECK_IN_MYINBOX: This parameter provides the information that whether the agents are excluded from receiving the workitem or they are excluded from approving or rejecting the workitem in their ‘My Inbox’.

Changing Parameter

  • EXCLUDEDAGENTS: This contains the agents who are excluded from approving the work item in the current approval level.

Example Implementation

CASE check_in_myinbox.
WHEN abap_true.
*Populate the list of agents to be excluded from approving, after the user has already
*approved in a previous step, when the workitem was forwarded to the user
DATA(userid) = cl_abap_context_info=>get_user_technical_name( ).
SELECT \_workflowstatusdetails-workflowtaskprocessor
FROM i_workflowstatusoverview
WHERE sapbusinessobjectnodekey1 = @supplierinvoice
AND sapbusinessobjectnodekey2 = @fiscalyear
AND workflowscenariodefinition = @workflowscenario
AND \_workflowstatusdetails-workflowtaskresult = 'RELEASED'
INTO TABLE @DATA(approvers).
IF sy-subrc = 0.
READ TABLE approvers WITH KEY workflowtaskprocessor = userid TRANSPORTING NO FIELDS.
IF sy-subrc = 0.
APPEND userid TO excludedagents.
ENDIF.
ENDIF.
WHEN OTHERS.
*Populate the list of agents to be excluded from approving the workitem. This can be
*configured from Step Properties for Workflow Step in the App Manage Workflow for Supplier Invoices
excludedagents = VALUE #( ( |{ 'MMPURMANAG1' }| )
( |{ 'MMPURMANAG2' }| ) ).
ENDCASE.

The above implementation does the following:

  • If the value of check_in_myinbox is true, we are checking if the current user id is present in the ‘previousapproverlist’ and we are populating the excludedagents with this user id.
  • If the value of check_in_myinbox is false, we are populating the users MMPURMANAG1 and MMPURMANAG2 in the excludedagents table.





SUBST_MERGE_LIST - merge external lists to one complete list with #if... logic for R3up   General Data in Customer Master  
This documentation is copyright by SAP AG.

Length: 5323 Date: 20240523 Time: 202148     sap01-206 ( 87 ms )