Skip to Content
Product Information
Author's profile photo James Denning

Flexible Workflow – Purchase Order Creator Email Notification


As of SAP S/4HANA Cloud 1902 email notifications concerning approval results can be sent to the workflow initiator however with SAP S/4HANA Cloud 2111 release the Purchase Order workflow supports Configurable Email Notifications at the end of the workflow providing the possibility to choose an outcome of when an email will be sent, an associated email template and a recipient rule or delivery to fixed users.


Business Use Case

There are conditions where the workflow initiator may not always be the document creator.

For example, a document creator or other Purchaser has made some amends during the approval flow for the document and the approval workflow has been restarted. In this case the workflow initiator of the restarted workflow is a person who has changed the document and may not always be the document creator.

On such occasions the result of approval could be missed from the document creator.



Generally, configuration of Email Notifications at the end of the workflow as of SAP S/4HANA Cloud 2111 is very similar to that of Deadline Email Notifications. More information can be found here: How to enable email notifications for purchase order approvals and rejections? – SAP Help Portal

By using this one can select an outcome of when an email will be sent, email template, recipient rule or fixed users. In addition to the pre-delivered recipient rules a customer can define a Custom Responsibility Management (RM) Rule which will be also exposed in the list of supported recipients and among approver lists. So, customers should provide a custom name to a rule self-explaining that it is for email recipients.

With this blog I will outline the steps to achieve this routing to a document creator (Purchase Order creator in this case) regardless of who the workflow initiator is.


  1. Add a new responsibility management rule.

Add the following parameters:

Name Description Type CDS View CDS Field Data Source Short Descript.

  1. Navigate to the below app

Extend the Parent Context ID WS00800238 – Workflow for Purchase Order


  1. Navigate to the custom logic app


Example code:

"Sample Implementation


IF parameter_name_value_pair IS BOUND.


DATA(lo_iterator) = parameter_name_value_pair->get_iterator( iv_reset_current_iteration = abap_true ).

CATCH cx_ble_dynamic_table_error INTO DATA(lr_dynamic_table_error).       " Dynamic table handling errors.

RAISE EXCEPTION TYPE cx_ble_runtime_error


previous = lr_dynamic_table_error.



WHILE lo_iterator->next_row( ).

DATA(lv_po_objectid)    = lo_iterator->get_value( 'PURCHASEORDER' ).     "YY1_PURCHASEORDER is the parameter name

SELECT SINGLE * FROM I_PurchaseOrderApi01 with PRIVILEGED ACCESS where purchaseorder = @lv_po_objectid INTO @data(ls_purchaseorder).


CATCH cx_ble_dynamic_table_error.

*INTO DATA(lr_dynamic_table_error).        " Dynamic table handling errors.

RAISE EXCEPTION TYPE cx_ble_runtime_error


previous = lr_dynamic_table_error.


AGENTS = VALUE #( ( ls_purchaseorder-CREATEDBYUSER ) ).


NOTE: This code is just an example and is not intended to be use in productive scenarios.


Ensure filter is applied to the BaDI using static_rule_filter = YY1_PO_CREATOR


Note: this BaDI cannot be tested in situ in the app as users are determined at runtime.

  1. Navigate to the workflow configuration apps and setup the required rules consuming the new responsibility management rule added in the previous steps.

Select the workflow notifications section.

Select the newly available “PO Creator” from the dialog box.

Continue with the usual flexible workflow setup and activate the rule.

Validate the approval email notifications are dispatched to the PO creator as below.

The standard email notification template is utilised as per below.

Note: please ensure the email setup has been followed as per best practice scope item 1LQ


So, in summary by utilising a custom responsibility management rule and harnessing the released SAP S/4HANA Cloud enabled BAdi we can communicate the workflow status to purchase order creators in this scenario but also across a number of business documents where applicable.


What are your ideas and business needs to utilise custom responsibility management scenarios?


Some useful resources:

General documentation for workflows in S/4 Procurement

Configurable email notifications at the end of the workflow

SAP Best Practices for SAP S/4HANA Cloud

SAP Fiori Apps Reference Library

SAP Activate Methodology for SAP S/4HANA Cloud

SAP Roadmap Explorer







Assigned Tags

      You must be Logged on to comment or reply to a post.
      Author's profile photo Junaid ALAM
      Junaid ALAM

      James Denning - Super work bro. Looking forward for more blogs from you.

      Implemented similar scenario for one of the customer. This Blog will definitely help the community to implement workflows utilizing the maximum options available in S/4HANA Cloud.


      Author's profile photo Rahul Shrivastava
      Rahul Shrivastava

      Really helpful. Solved a complex issue. Thank you James.

      Author's profile photo Frank Li
      Frank Li

      Hi James,

      If develop one completely new Customer Fiori App on S4HANA OP, which means the backend table and CDS view, Odata service are completely customer owned and want to fulfill this blog mentioned email notification within flexible workflow and utilize S4HANA Responsibility managment, there might be lots of implementation steps need to adopt. Is there any detail guides or material can refer to achieve those? Thank you.

      Author's profile photo Rupali Pawaskar
      Rupali Pawaskar

      Hello James,

      This blog was really helpful. Do we have similar set for SD Flexible workflow?

      We have a similar requirement where the workflow initiator is not the document creator and approved notification is sent by default to workflow initiator.