cancel
Showing results for 
Search instead for 
Did you mean: 

How to send Email to Manager

Former Member
0 Kudos

Hi experts,

How do i send email to manager via workflow? i know this question has been asked so many times but i need more technical detail, here is what i have done so far:

1. Create workflow

2. Create function module for extracting the superior user id

My understanding so far is to create a rule that calling the function module, and use the rule in agent determination. But sending email does not need an agent so basicly how do i call the rule so the fm could be called and the binding is passing the value? Thanks

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

Thanks before, but i'm new to this. Could some one give me a little bit detail instruction? Thanks before

suresh_subramanian2
Active Contributor
0 Kudos

Hello Hendri Salim !

Create a background step which uses SWX_GET_MANAGER to find the manager.

Populate the manager name in workflow container of mail step.

Create job variant for the report RSWUWFML2, and in the job variant , configure the task id of the mail step.

Also maintain following settings in the job variant :

Select "Only New Workitems" check box.

Select "Workflow Entry " check box

Coding for SWX_GET_MANAGER to get SAP log on id of manager as follows : Change the coding as required to get e-mail id.

BEGIN_METHOD FINDMANAGER CHANGING CONTAINER.
DATA:
      EXTENDEDOBJECTID TYPE OBJEC-REALO,
      addresstype like soxna-type,
      RECIPIENTADDRESS TYPE SOXNA-FULLNAME.

DATA:
      ac_container like swcont occurs 0 with header line,
      addressstrings like soxna-fullname occurs 0 with header line.

  SWC_GET_ELEMENT CONTAINER 'ExtendedObjectID'

addresstype = 'G'.
ac_container-element = 'OBJID'.
ac_container-tab_index = '000001'.
ac_container-elemlength = '008'.
ac_container-type = 'N'.
ac_container-value = EXTENDEDOBJECTID.
append ac_container.

ac_container-element = 'OTYPE'.
ac_container-tab_index = '000001'.
ac_container-elemlength = '002'.
ac_container-type = 'C'.
ac_container-value = 'P '.
append ac_container.

  CALL FUNCTION 'SWX_GET_MANAGER'
    TABLES
      ACTOR_TAB = addressstrings
      AC_CONTAINER = ac_container
    EXCEPTIONS
      NOBODY_FOUND = 01
      OTHERS = 02.
  CASE SY-SUBRC.
*    WHEN 0.            " OK
*    WHEN 01.    " to be implemented
    WHEN OTHERS.       " to be implemented
  ENDCASE.
  loop at addressstrings.
  if addressstrings(2) = 'P '.
  delete addressstrings.
  endif.
  endloop.
move addressstrings to recipientaddress.
  SWC_SET_ELEMENT CONTAINER 'RecipientAddress' RECIPIENTADDRESS.
END_METHOD.

Regards,

S.Suresh

Answers (3)

Answers (3)

Former Member
0 Kudos

Create a task that will execute the method which executes FM

SWX_GET_MANAGER

Retrieve the users and concatenate them with US in front.

Pass this value in a container element to workflow and use this as expression in the send mail step.

Thanks

Arghadi[

Former Member
0 Kudos

Else, you can create a background step before 'Email' step . In the background step you can read the rule and pass it to a local workflow container.

Then in the email step, you can choose 'Expression' option and assign the work flow contiane

Hi,

Where can i use rule in the background step? i only can use Task, and if i use agents (where i can put ruke) then the task cant be background ? Thanks

Former Member
0 Kudos

Hi Salim,

'Email' has recepients section where you can do the agent determination. If you know the position of the manager, you can assign a position.

Else, you can create a background step before 'Email' step . In the background step you can read the rule and pass it to a local workflow container.

Then in the email step, you can choose 'Expression' option and assign the workflow contianer.

Hiranmayi