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

How to send mail to external email within workflow

Former Member
0 Kudos
8,653

Hi Expert,

I know this question has been questioned before in the forum but that is quite different from what i want. After researching in this forum i found out that forwarding was the way to move the inbox into the external mail (using scheduled job) but what i want is to include send mail activity within the workflow that directly send email into the external email ( so no scheduled job). The logic is perhaps:

1. get the email address

2. use send mail activity

3. Assign the element defined to E-Mail Address.

4. send the email.

But I'm unable to retrieve the email address, store it and pass it into the email (as element). Can somebody help me with this?

Many Thanks.

View Entire Topic
Former Member
0 Kudos

Use the below code(rule(fm)), hope it works for you.

I have placed the SAP user id's in custom table & inserted e-mailid's to them in su01.

FUNCTION ZMANI_GET_PLANNER.
*"----------------------------------------------------------------------
*"*"Local Interface:
*"  TABLES
*"      AC_CONTAINER STRUCTURE  SWCONT OPTIONAL
*"      ACTOR_TAB STRUCTURE  SWHACTOR
*"  EXCEPTIONS
*"      NOBODY_FOUND
*"----------------------------------------------------------------------

  INCLUDE <cntn01>.
  TYPES : BEGIN OF ty_users.
          INCLUDE STRUCTURE ZMANI_AGENT_MAST.
  TYPES : END OF ty_users.

  DATA: org_agent LIKE wfsyst-agent,
        lt_holders TYPE STANDARD TABLE OF swhactor,
        lwa_holders TYPE swhactor,
*        lt_users TYPE STANDARD TABLE OF ty_users,
        lwa_users TYPE ty_users,
        v_len TYPE i,
*        v_bname LIKE ztest_users-bname,
        num_lines TYPE i.

** Read values assigned to the rule criteria
  swc_get_element ac_container 'org_agent' org_agent.

* Get the superior
  SELECT SINGLE *
    FROM ZMANI_AGENT_MAST
    INTO CORRESPONDING FIELDS OF lwa_users
   WHERE MMC = 'Y'.

  IF NOT lwa_users IS INITIAL.

    REFRESH lt_holders[].
    lwa_holders-otype = 'US'.
    lwa_holders-objid = lwa_users-BNAME.
    APPEND lwa_holders TO lt_holders.
    APPEND LINES OF lt_holders TO actor_tab.

  ENDIF.

  DESCRIBE TABLE actor_tab LINES num_lines.
  IF num_lines IS INITIAL.
    RAISE nobody_found.
  ENDIF.


ENDFUNCTION.

SanketGode45
Explorer
0 Kudos

Hi @everyone ,

I have done the required things,

created a workflow start with user decision.

where i have given user as my user name in se01 and tried creating new user with different mail id also.

assign that created two decision as approve reject and then add send mail mapping for respective users also.

but when i run the workflow no email is going in sost or to the user.

i have the required things in se01 where choose the method email , and done so16 config.

where choose

in SO16, tab Mail sy.grp, radio button "Send to Home Addresses of Users"

 in SO16, tab Addressing, Reset buffer.

but mail is not trigger ?

anyone can help ?