cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

class based workflow - trigger mail to multiple recipients

kjyothiraditya
Participant
0 Likes
2,385

Hi Experts,

I have basic knowledge on workflow, so please correct me if I say anything wrong.

I have to send a mail to a list of approvers whenever a PO is created. The challenge here is a mail should be sent to a list of approvers notifying them of PO and the user would then open PO and do the needful upon notification. Here i have to send mail to a list of users which need to be retrieved from a table. Also in SEND_EMAIL step in workflow, how to configure to send in a loop.

Also, can i add any custom step in workflow like call FM/class to trigger email passing PO details ?

Please guide.

Regards,

Aditya

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member

Hi,

If you want to inform users that they need to approve their workitems, or if you want the option to approve their workitems directly from their mail box, then you should use extended notifications (SWN_SELSEN) to make this possible.

There are many blogs on this subject and there is also a document on SAP KBA about this.

Kind regards, Rob Dielemans

Sandra_Rossi
Active Contributor

I will just answer the question how to send an email to multiple recipients:

  • In the workflow container, define a "table" container element ZUSERS (or the name you want) with line type SO_NAME, check "multiline" so that it's a table. This element will be used to pass all email addresses to the activity step/task "send mail".
  • Insert a workflow activity to initialize the element with the list of all SAP user IDs: make it call a custom standard task which calls a method from a custom business object type (SWO1) or a custom workflow-enabled class (SE24, class implementing IF_WORKFLOW), which will return one SAP user ID by line, each ID being prefixed with "US") - in the binding, pass the element &ZUSER&.
  • Insert a send mail step, in the binding pass the element, select the receiver type "Organizational Object" and select the receiver "Expression" &ZUSERS&.

PS: no need of a loop to send the same email to multiple recipients.