Skip to Content

In the first part, I covered the development needs to be done to get a customized alert. You can find first part below

Customize E-Mail Body and Subject in Alerts in SAP PI 7.31 – Java Stack Only – Part 1 – ESR

In this part, I will talk about the configuration of this scenario.

We are going to configure a File – Sync SOAP – Mail scenario. To configure this scenario, I am using below beans to get response from SOAP and then send that response to recipients using mail adapter.

  1. RequestResponseBean
  2. ResponseOnewayBean

  I have used these beans earlier for scenarios like File – JDBC/RFC/SOAP – File receiver and without much effort it works. But if you change receiver adapter other than File receiver it starts giving errors. I want to take this opportunity to give solution to the errors we receive because of usage of above beans.  

Standard errors you will get when you use these beans are –

  1. CPAObjectKeyException for ResponseOneWayBean

I have seen some threads open with these errors or similar errors due to these bean usages.

Solution of above exceptions is configuration of bean in module tab. We should do configuration like below screenshot.

Pic1-Part2.jpg

Now I will move to configuration. I have created one business component BC_Alerting, where I will create my communication channel.

We need to create 3 communication channels.

  1. File Sender – To send the actual values of Consumer and number of alerts we want to send in one go.
  2. SOAP Receiver – It will call to standard webservice (Through Target URL)
  3. Mail Adapter – It will send webservice response to correct recipients.

File Sender Adapter Configuration – Only showing module tab in below screenshot.

Pic2 -Part2.jpg

SOAP Receiver Adapter Configuration –

Pic3 - Part2.jpg

You can get target URL from Service Registry and search for *alert* and then you will get Service Interface related to alert.

Mail Receiver Adapter configuration – I am not doing any conversion here but we can do it anyways. So output through mail will go as attachment and in XML format.

Pic4-Part2.jpg

Create an ICO for this with Sender Adapter as File Sender and receiver adapter as SOAP Adapter.

Activate all objects and we are ready to test it.

Source Message

Pic5-Part2.jpg

Output Mail –

Pic6 - part2.jpg

Attachment –

Pic7-part2.jpg

This is one of the solutions we think of. It may vary from person to person. This solution can be customized more depending upon the requirement.

To report this post you need to login first.

16 Comments

You must be Logged on to comment or reply to a post.

  1. Jaydeep Saha

    Hi Aashish,

    Great blog. We are trying to customize the CBMA Alert mail body and stuck at a place.Could you please shed some light on how the Alert Consumer(Standard/Custom) in PI can be integrated with the custom solution you mentioned.

    Thanks,

    Jaydeep

    (0) 
    1. Aashish Sinha Post author

      Hi Jaydeep,

      Really sorry to reply you so late.

      Alert Consumer we mostly use to configure our alert job in NWA. In case we are using custom/standard, we need to pass this value in consumer id field. You can refer to the first blog of this series, where i am sending consumerId from file to webservices.

      Regards

      Aashish Sinha

      (0) 
      1. Jaydeep Saha

        Thanks Aashish. I read 1st part .Now my doubt is , how this alert will be converted as XML file format and how the file can be sent to the sender channel automatically.  You mentioned ” With the help of these standard webservices we can create a scenario in SAP PI and raise an alert for each error” in the 1st blog.

        So if we want to customize CBMA alert  we need to build this interface/scenario and if yes,how this alert will be converted as XML file format and how the file can be sent to the sender channel automatically.

        Regards,

        Jaydeep

        (0) 
        1. Aashish Sinha Post author

          Hi Jaydeep,

          As you understand from first blog, it is going to be File – Synchronous SOAP Call – Mail scenario for this custom solution. Means this scenario to work, we have to place a file on server from where this scenario will get triggered.

          So like any Sender file scenario, to initiate we have to place a file to sender location.

          This is the only drawback i see in this approach. You can overcome this by, lets say you write one script to place a file every 10 seconds in sender location, to get an error alert in your mailbox for a custom or standard consumer, if any alert is there for your consumer.

          Regards

          Aashish Sinha

          (0) 
          1. Ven A

            Hi Aashish,

            Its a good blog, very much useful. But my doubt is that how can we place a file for File sender though it is with script also what is the location to pick for placing the file?

            Thanks.

            VR

            (0) 
  2. Indrajit Sarkar

    Hi Aashish

    So the scenario will only work if there are any alert message existed for that consumer. Now suppose the consumer has two alerts where second alert message generated 10 seconds after the first alert..how  can you make sure that the output email will be generated for only the second alert not the first one….???

    (0) 
    1. Aashish Sinha Post author

      HI Indrajit,

      Once alert is consumed for one message, it won’t come again in the lis of”to be consumed” alert. Lets say if i have 5 messages to consume in first run of 10s, it will get consumed and list will be empty for other 5 to be consumed.

      Regards

      Aashish Sinha

      (0) 
        1. Kavitha S

          Hi Aashish,

          Does this approach work for PI 7.31 dual stack? With this scenario, i see alerts are created only for AE failures.Or am i missing anything to create alert for IE errors and retrieve it using API?

          Regards,

          Kavitha

          (0) 
          1. Aashish Sinha Post author

            Hi Kavitha,

            This approach work in dual stack as well. For IE alerts you need to locate SXMSALERT_SEND_VIA_MAIL in ABAP Editor and schedule job. For more details have a look into below 2 links –

            Link1

            Link2

            Link 2 contains details.

            Regards

            Aashish Sinha

            (0) 
            1. Kavitha S

              Hi Aashish,

              Thanks for your response. I am calling the web service as per your blog to retrieve alerts (created for both AE and IE failures ) from the alert engine. Will not this be sufficient to capture the IE failures too? As per my understanding, we schedule the a ABAP job for SXMSALERT_SEND_VIA_MAIL to send the alert to the attached distribution list.

              But in our case, aren’t we reading the alerts created for all the runtime components directly from the local alert store?

              Please throw some light.

              Kavitha.

              (0) 
  3. divyesh vasani

    Nice one 🙂

    I just wanted to clear one point on triggering point, which will always be file having consumer and MaxAlerts parameters.

    We can not automate this right, I mean periodically reading alerts from consumer store and then sending mail in this scenario?

    Divyesh

    (0) 
  4. David Pauley

    Aashish,

    You are using the File Adapter sender, where are you picking up the alerts from?  Where are they stored in PO 7.4?

    Thanks,

    David

    (0) 

Leave a Reply