Skip to Content
avatar image
Former Member

Sending an email based on a value in the payload

Dear friends,

I've the following scenario:

Non-SAP to Non-SAP - synchronous

Based on a value in the field status I've to send an email to people responsible for this message flow and the message has to be processed succesfully.

We are using PI standalone Java so we dont have a ABAP Stack...


I think I have to use a UDF or is there another way to do it? If I have to use an UDF can you please provide me with the java code?


Thank you in advance,


Your help would be greatly appreciate it,


Kind regards,


John

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Best Answer
    Apr 03, 2014 at 05:10 PM

    Can you provide some more details about your scenario ?

    Non-SAP to Non-SAP - synchronous

    Is it synchronous? what is your sender protocol and receiver protocol?

    Where &when do you want to send the email?

    If you simply want to send emails from mapping, have a look at the below blogs -

    Mail without email adapter? Part - I - Process Integration - SCN Wiki

    Sending Notification with attachment using Java Mail API in SAP PI Map

    Add comment
    10|10000 characters needed characters exceeded

  • Apr 03, 2014 at 05:09 PM

    Hello,

    Use mail package and depending upon the status field value populate ur content (under content field in mail xsd) and send mail to user group.

    >>I think I have to use a UDF or is there another way to do it? If I have to use an UDF can you please provide me with the java code?

    What's ur logic and when exactly u want to send email?

    Thanks

    Amit Srivastava

    Add comment
    10|10000 characters needed characters exceeded

  • Apr 04, 2014 at 05:29 AM

    Hello John,

    probably you tried it already, but why don't you configure two message mappings?

    1.- One for the messages that have the status A, B or C

    2.- One for the messages that have any other status. This last mapping should produce an xml similar to the following:

    <ns:Mail xmlns:ns="http://sap.com/xi/XI/Mail/30">

      <Subject>Subject</Subject>

      <From>namea@company.com</From>

      <To>nameb@company.com</To>

      <Reply_To />

      <Content_Type>text/plain</Content_Type>

      <Content>

    This is the content.

      </Content>

    </ns:Mail>


    In your ICO or Interface Determination you can create two conditions:

    1.- One for the messages that have the status A, B or C

    2.- One for the messages that have any other status.

    And depending on the condition, you execute one mapping or another. Finally you can use a Soap Receiver Channel to send "normal" messages and the email adapter to send "error" messages.

    Please, check the following links for further information:

    Configuring the Receiver Mail Adapter (SAP Library - Partner Connectivity Kit)

    XI/PI: Sending Emails Using XI Mail Adapter


    I hope it helps!

    Regards!

    Add comment
    10|10000 characters needed characters exceeded