cancel
Showing results for 
Search instead for 
Did you mean: 

Send Mail to Creator of PO in Workflow

Former Member
0 Kudos

Hello Experts,

I've a question regarding Sending Mail (in SAP Inbox) in Workflow.

Actually, the workflow is triggered when a user changes a PO, which he/she has not created.

Example:

User A creates PO 4300020245

User B modifies PO 4300020245

User A must receive a mail.

I've already created the Send Mail activity. But I'm having some issues for the recipients.

I would like to use Expression and add the variable of Creator of PO, but it does not accept. (apparently the problem is because of preceeding US - but how and where to concatenate?).

Any idea of how to send mail to creator of PO when it has been changed by another user?

Below some screenshots which might be helpful.

Send Mail

Binding

Thanks in anticipation

Feenz

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

How to concatenate US in a variable to be used in Expression. (screenshots)

Go to SE24, create a class: ZCL_WORKFLOW_PO.

Interfaces:

Methods:

Attributes:

Choose Constructor and click Parameters:

Add the following:

Choose GET_RESULT and click Parameters:

Add the following:

Go back, double-click in GET_RESULT and add the following:

Choose CREATE and click Parameters:

Add the following:

Add the following in the Create method:

Double-click on BI_PERSISTENT~FIND_BY_...

Add the following:

Double-click on BI_PERSISTENT~LPOR

Add the following:

Double-click on all the other methods and activate them (even if they are blank)

In Workflow - Transaction SWDD

Create 2 containers: CREATOR and BUS2012

Container CREATOR

Go to the Properties Tab and in the parameter settings check the Import checkbox.

Container BUS2012

Go to the Properties Tab and in the parameter settings check the Import checkbox.

Click the Hat icon, in the left top of screen, known as the Start Condition.

Category: BO

Object Type: BUS2012

Event: Changed

Save

Click the first button (diamond shaped) to activate, it will turn green.

Click the second icon to do binding.

Add the following for the binding:

Create new activity

In transaction PFTC, create task ZCALL_CREATE with the following data:

Click on Binding and add the following:

Save and go to the workflow. Add the task in the Task field.

Go to PFTC and create another task: Z_INSTANCE:

Click Binding and add the following:

Go to workflow, create a new activity and add the task:

Save and go back:

Create a Condition step since we have to put a condition of checking where creator and changer are not-equal/equal.

Click on "Click here to create new condition" and give the following condition.

Click "√" and the following screen appears.

Create another Activity and go to transaction PFTC.

Create a task PO_MODIFY

Click on Binding:

In the workflow, add the task:

Add the Send Mail step with the following info:

The workflow model should now be looking like this:

Create a Process Control at the end with the following info:

Below is the final workflow model:

How to Test?

This workflow notifies the author of PO when another user has modified it.

Steps:

Transaction ME22N to modify a PO by another user:

PO was created by user FBH....

PO will be modified by user YBI...

The workflow will be triggered when saved.

Express Notification of Email (user FBH..)

Verify in the Inbox of user FBH..

Finally, here is the graphical view of the steps which have been done by the workflow.

Any questions, please don't hesitate.

Answers (5)

Answers (5)

paul_bakker2
Active Contributor
0 Kudos

Hi Feenz,

Where are you getting the name of the PO Creator from? If it's an object attribute, check if there isn't another which has the US attached to it. You may want to consider adding that attribute.

Otherwise, create a CONCATENATE method in a Common object or class to be able to do the concatenation. It may even already exist. Use that in your workflow as a step before the SendMail.

cheers

Paul

former_member186746
Active Contributor
0 Kudos

Hi,

there is always the standard workflow container _workitem.CreatedByUser.NameWithLeadingUS to use.

Other than that I usually just add an attribute with the data I need for my business processes modeled with Workflow.

Kind regards, Rob Dielemans

Former Member
0 Kudos

Hi,

please would tell us which t code you are using for binding ,we are facing same problem in our process,

thanks

p_soobhany
Participant
0 Kudos

You need to bind in PTFC when creating the task and also in SWDD in the activity

p_soobhany
Participant
0 Kudos

Hello,

You can define a class in SE24 in which you can define a method to concatenate the 'US' with ekko-ernam into a new container of type similar to _WF_INITIATOR.

Use the new container for sending mail.

For more information, check these links:

http://www.saptechnical.com/Tutorials/OOPS/InWorkflow/page1.htm

http://saptechnical.com/Tutorials/Workflow/Classes/Instance.htm

Hope it helps...

Parvez

Message was edited by: Parvez Soobhany

former_member215344
Contributor
0 Kudos

Hi Feenz,

As far as I know there is no way to concatenate a container value. (you can assign a container a particular vaue using container operation step but not concatenate)

A simple way to achieve this is to create a custom business object and a method and call this method to populate the container with the PO creator value.

This method can have an import paramter - PO number and export parameter - Receipient. In the method you can get the PO creator from EKKO and concatenate it with 'US' and pass it as export parameter to the workflow.

Make sure you create the BO method as an instance in-dependent method so that you can directly call the BO method in your workflow without any instantiation of the BO.

Pls reward if found useful.

Thanks,

Ajay