Skip to Content
author's profile photo Former Member
Former Member

Sending a mail to Outlook instead of SAP Inbox

Hi all,

I have copied the standard workflow WS92000007 (Purchase order release) and when the purchase order is created in ME21N, a work item goes to SAP inbox to the user who first has to release the PO.

Along with this a mail needs to be sent to mail address of the user. I have added the send mail step and used Recipient type = U and gave the mail address and it works perfectly.

My question is the mail needs to go to the relevant user who needs to release the PO. This needs to be done dynamically. How can i do this ?

Thanks

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

9 Answers

  • Best Answer
    Posted on Dec 23, 2008 at 04:28 AM

    Hi RV,

    Read the solution that I have posted for your query.

    I have tried it out and it works for me!

    Do let me know if you face any further issues.

    Regards,

    Saumya

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Hi,

      Yes it is necessary to create parameters, if you want to pass data from method container to task container and from task container to WF container.Be careful with the binding of these parameters

      Parameters should be import/export type.

      Let me know if u face any issues creating paramteres.

      Regards,

      Kanika

  • Posted on Dec 22, 2008 at 08:02 AM

    Hi,

    Write a Method which should pick the email of the relevant user who needs to release the PO, then export the variable which containing the email id.

    In the step mail step, instead of hard coding the email id, you can assign the variable. This you can do by press in F4 help and assign the variable.

    Regards,

    Surjith

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi Surjith and Saumya,

      Thanks for your quick response.

      @Surjith

      Yes the data is present in the table T16FW. So should i create a Z class for this ? I can give the input as PO number for the class and get the desired details. How should i use this class in my workflow ? Should i add a new step for this ?

      @Saumya

      I am using the business object BUS2012 - Purchase Order. I could not find any field for mail address of the user who needs to release the PO. If you have worked with this object , let me know of the field to use.

      Thanks

  • Posted on Dec 22, 2008 at 08:07 AM

    Hi RV,

    Is a business object associated to your workflow?

    If yes, then instead of hard-coding the value of the email address in the send mail step, click on the F4 help and fetch the email address from the business object attribute that is storing the user details.

    Hope this helps.

    Regards,

    Saumya

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Dec 23, 2008 at 05:07 AM

    Hi,

    The approver/agents names must be stored in a table. In a method you write the code that gets the user name based on the condition. Then you write the code that gets the mail ID the user name from the corresponding. Then you pass this value to the workflow container. Set receipient Type as U.

    This should work.

    Regards,

    Raj

    Add a comment
    10|10000 characters needed characters exceeded

    • Hi,

      It is not necessary? Just click on no and proceed further. Write your code.

      Here is the sample code.

      SELECT SINGLE * FROM ZWF_PO_SD_ALL INTO WA_AGENT WHERE MOD = 'PR' AND

      ORDERTYP = ORDERTYPE AND PLANT = PLANT AND ORG = ORG AND GRP = GRP AND

      ( DATAB <= SY-DATUM AND DATBI >= SY-DATUM ).

      Similarly now once you get the user name write another select statement to find out the mail ID,

      Pass this mail ID to the task container.

      Do the binding between task and workflow container.

      Use this workflow container as your agent assignment.

      This should do the job.

      let me know if you have any queries.

      Regards,

      Raj

  • author's profile photo Former Member
    Former Member
    Posted on Dec 22, 2008 at 09:06 AM

    This can be accomplished without using send mail step. Just use report RSWUFML2 to generate mail for each workitem to outlook. Make sure thje email address is maintained in SU01d transaction code and SCOT is properly configured.

    Thanks

    Arghadip

    Add a comment
    10|10000 characters needed characters exceeded

    • Hi,

      There is no std. approver field in the BO, you have to create a Z-Method and attach it to the BO and make the variable as export parameter. Inside the workflow, it will come as an expression and assign that expression in the E-Mail Address.

      When ever you workflow execute it will pick the approver email id at the runtime and it will be sent.

      If you maintain the approver user id in SU01, pass User id to FM BAPI_USER_GET_DETAIL and get the email id.

      Else if you maintained in the HR master data Pass Emp. No to FM BAPI_EMPLOYEE_GETDATA and get the Email id.

      Regards,

      Surjith

  • Posted on Dec 22, 2008 at 09:10 AM

    Hi RV,

    You have a solution then !

    Delegate your BO BUS2012 to say Z-BO ZBUS2012. Now create a method inside the Z-BO where you write a query to the table T16FW and fetch the email ID value.

    Create an Activity in your workflow and make a call to this Z-BO method from it. Fetch the email ID as the output and store it in the container element.

    Now use this container element in your mail sending step. Done!

    Regards,

    Saumya

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Dec 23, 2008 at 08:00 AM

    Hi RV,

    Ceck this link it may help you in ur scenario.

    http://help.sap.com/saphelp_nw2004s/helpdata/EN/ad/d64842d59fb430e10000000a155106/content.htm

    Regards,

    Ravi.

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Dec 23, 2008 at 09:15 AM

    Hi RV,

    It is not mandatory to use "Create with function module as template?". You can select 'No' and proceed.

    Do the following:

    1. Go to t-code SWO1. Open the BO.

    2. Create a new method inside the BO to fetch the email ID.

    3. Now go to 'Parameters' button and enter the parameters. Create an export parameter that would return the email ID of the user.

    4. While creating don't select option "Create with function module as template?". You can manually enter the function module pattern after creating the method.

    5. Go to 'Program' button. It would ask for automatic generation of syntax. Select 'Yes'.

    6. Now start with your code to fetch the email ID. Assign the fetched ID to the output parameter.

    7. Fetch this output parameter in your workflow activity.

    That's it!

    Do let me know in case of further queries.

    Regards,

    Saumya

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Dec 23, 2008 at 09:17 AM

    Hi RV,

    It is not mandatory to use "Create with function module as template?". You can select 'No' and proceed.

    Do the following:

    1. Go to t-code SWO1. Open the BO.

    2. Create a new method inside the BO to fetch the email ID.

    3. Now go to 'Parameters' button and enter the parameters. Create an export parameter that would return the email ID of the user.

    4. While creating don't select option "Create with function module as template?". You can manually enter the function module pattern after creating the method.

    5. Go to 'Program' button. It would ask for automatic generation of syntax. Select 'Yes'.

    6. Now start with your code to fetch the email ID. Assign the fetched ID to the output parameter.

    7. Fetch this output parameter in your workflow activity.

    That's it!

    Do let me know in case of further queries.

    Regards,

    Saumya

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.