Skip to Content
Author's profile photo Arijit Mukherjee

Generate Formatted or structured EMAIL using CBMA

We could generate the alert emails using CBMA. But here I will describe the steps to generate the structured alert email .

 

You can follow the blog Interface specific Email Alert in PO using CBMA until Step3 and configure the alert. But instead of Step4, follow below steps.

 

  • Create a text File which will act as a template of the email body like below.

 

You can use the below list of variables in the template file to get the corresponding value from RunTime.

 

$severity$: Alert Rule severity

$alert_rule_id$: Alert Rule internal ID

$alert_rule_name$: Alert Rule name

$timestamp$: Alert creation time

$pi_component$: SLD instance name of the PI component that created the Alert

$scenario_id$: internal Integrated Configuration or IFLOW scenario ID

$scenario_name$: a readable scenario name for the Integrated Configuration or IFLOW scenario (note: this variable is only available with

the patch from note 2160374)

$error_category$: Error Category

$error_code$: Error Code

$error_label$: Error Label

$error_text$: Error Text

$error_parameters$: Additional error parameters

$msg_id$: Message ID of the PI message

$msg_from_party$: Sender Party of the PI message

$msg_from_component$: Sender Component of the PI message

$msg_to_party$: Receiver Party of the PI message

$msg_to_component$: Receiver Component of the PI message

$msg_interface$: Interface Name of the PI message

$msg_interface_namespace$: Interface Namespace of the PI message

$uds_attributes$: User Defined data from the PI message

$adapter_type$: Adapter Type

$adapter_namespace$: Adapter Namespace

$channel_name$: Communication Channel name

$channel_party$: Communication Channel party name

$channel_component$: Communication Channel component name

$monitoring_url$: URL link to Message Monitoring for the failed message (Http URL)

$secure_monitoring_url$: URL link to Message Monitoring for the failed message (Https URL)

 

  • Upload that text file in such a PO directory so that the location/file is readable by PO system. In my case I uploaded that under “/usr/sap/instanceID

 

pic1.JPG

  • Once uploaded,we need to schedule the AlertConsumerJobV2.

 

To do that go to NWA> Operations > Jobs > Java Scheduler > Task.

 

Click on Add and then select AlertConsumerJobV2.

pic1.JPG

 

Click Next and there you can change the TaskName and Description as per your wish. I kept that as it was.

pic1.JPG

On the next page you need to provide the parameters like EmailTemplateFile,Consumer,MailFrom,MailTo etc.

 

pic1.JPG

In my case I kept the below values.

 

Language:en

EmailTemplateFile:/usr/sap/instanceID/EmailTemplateTEST2.txt

Consumer:ALERT-TO-STRUCTURED-MAIL(This is the consumer which is used/created in the AlertRule in ID)

MailFrom:The alert email generator email ID

MailTo:The desired recipient for this alert

 

Then click on next and schedule the alert.

pic1.JPG

 

pic1.JPG

Now click On Finsh.

 

Now the alert email should be looking like below.

 

pic1.JPG

Assigned Tags

      10 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Former Member
      Former Member

      Hello.

      Can you please explain variable $uds_attributes$? At your post written:

      UDS Attributes: $SearchName$

      Where you define SearchName value? Is it value from NWA / SOA / Monitoring / User-Defined Message Search Configuration? Is it name of filter? Is it name of Search Criteria?

      Author's profile photo Arijit Mukherjee
      Arijit Mukherjee
      Blog Post Author

      Hi Ivan,

      I thought that would be name of Search Criteria. But this did not work for me till now. Please see the link AlertConsumerJobV2 in PO 7.31 SP14

      Author's profile photo Vaibhav Mishra
      Vaibhav Mishra

      Hi Arijit,

      We have followed all the steps mentioned above and created the email body template.

      But still we are not getting the alerts in specified format (we are still getting the alerts in standard format).

      Below is the screenshot of our scheduled job and the email template.

      AlertEmail Job details.PNG

      Here it is showing that the alert has been consumed.

      AlertEmailTemplate.PNG

      So could you please help us to know if we are missing some steps.

      Author's profile photo Former Member
      Former Member

      Hi Vaibhav Mishra,

       

      Did you solve that issue?

       

      Thanks,
      Leandro Silva

      Author's profile photo PRADEEP KUMAR
      PRADEEP KUMAR

      Hi Arijit,

      I am using this blog for creating customizing alert message but when i am creating task in job scheduler  there AlertConsumerJobV2. does not found.

      PI system : 7.4 Dual stack

      Please suggest how this job is show under TASK tab.

      Thanks,

      Pradeep Kumar

      Author's profile photo Azeem Syed
      Azeem Syed

      Hi Arijit,

       

      Thanks for providing the good blog.

      i have followed the same approch as provided by you.Now alerts are created successfully.

      I have given alert mail template like below.

      Hi,

      Email Alert for Master interface.

      Alert was triggered with severity : $severity$ at $timestamp$ for Alert Rule $alert_rule_name$ on $pi_component$

      The alert contain the following information :

      Err Category : $error_category$
      Message ID : $msg_id$
      Interface Name : $msg_interface$
      Interface Namespace : $msg_interface_namespace$
      UDS Attributes : $uds_attributes$

      Thanks
      PO Team

       

      But we are recieving the 2 extra lines in mail as mentoin below.Can you please let me know how to remove these 2 line...we are not mentioning these 2 lines in template also(after 2 extra lines alert template populating).

       

      Root cause: Receiver Delivery: Receiver channel stopped or inactive - Receiver channel stopped or inactive

      To navigate to the failed messages in the local message monitor, use this Link

      Hi,

      This is a Email Alert triggred for |Master|| interface failure in SAP PI

       

      Regards,

      Azeem

      Author's profile photo Prerna Sharma
      Prerna Sharma

      Hello Azeem,

       

      Were you able to resolve this issue. If yes How?

      Because, I am also facing the same scenario and would like to remove these lines or atleast place this at the last in email.

       

      Regards,

      Prerna

      Author's profile photo Douglas Figueiredo
      Douglas Figueiredo

      Did you solve this problem ? I'm facing the same issue !!

       

      regards

      Douglas Figueiredo

      Author's profile photo Azeem Syed
      Azeem Syed

      Hi Prerana,

       

      Not resolved.

      I am also searching for solution.Please post the comments if you find anything.

       

      Regards,

      Azeem

       

      Author's profile photo K Umasankar
      K Umasankar

      Hi,

      We are adding the interface name and all in the email Template which is OK.. as we are sending the email to business, they wont be able to understand our naming convention of interface. So how can we print out the interface name as plain formal text rather than PO naming convention

      PO interface name – XXXXX_XXX_SI_CustomerMaster_Async_In.

      What we need – Customer Master Interface

      Is their any property that we can add in template like.. .instead of fetching interface name… is there any property for fetching interface description (where i will add plain interface text in ID)