cancel
Showing results for 
Search instead for 
Did you mean: 

Alert monitoring With specific message details

Former Member
0 Kudos

Hi experts,

Is it possible to add to emails sent by pi alert monitoring specific message details.



Especially:

file name and time

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Zevik

Yes it is possible. There is an standard RFC called SALERT_CREATE which you can use for triggering alert email with message data.

You can call the RFC by standard mapping function RFC look up or you can write an UDF for calling the RFC.

Below is the sample code for calling it from UDF

java.util.Map map;

try {

String msgid;

map = container.getTransformationParameters();

msgid = (String) map.get(StreamTransformationConstants.MESSAGE_ID);

Channel channel = LookupService.getChannel("DE1CLNT100","CC_RFC_R_PI");

RfcAccessor accessor = LookupService.getRfcAccessor(channel);

String rfcXML= "<ns0:SALERT_CREATE xmlns:ns0=\"urn:sap-com:document:sap:rfc:functions\">"+

      "<IP_ALIAS/>"+

      "<IP_APPLICATION_GUID/>"+

      "<IP_CAT>ALERT_TEST_UDF</IP_CAT>"+

      "<IP_XML_CONTAINER/>"+

      "<IT_CONTAINER>"+

         "<item>"+

            "<ELEMENT>ZCUSTOMER</ELEMENT>"+

            "<TAB_INDEX>0</TAB_INDEX>"+

            "<ELEMLENGTH>20</ELEMLENGTH>"+

            "<TYPE>C</TYPE>"+

            "<VALUE>"+pnum+"</VALUE>"+

         "</item>"+

           "<item>"+

            "<ELEMENT>ZMSGID</ELEMENT>"+

            "<TAB_INDEX>1</TAB_INDEX>"+

            "<ELEMLENGTH>70</ELEMLENGTH>"+

            "<TYPE>C</TYPE>"+

            "<VALUE>"+msgid+"</VALUE>"+

         "</item>"+

      "</IT_CONTAINER>"+

    "</ns0:SALERT_CREATE>";

InputStream inputStream =new ByteArrayInputStream(rfcXML.getBytes());

XmlPayload payload = LookupService.getXmlPayload(inputStream);

Payload rfcOutPayload = accessor.call(payload);

throw new  StreamTransformationException ( " Message Mapping Failed because of invalid Customer number");

}

catch(Exception e)

{

  throw new RuntimeException("Exception while checking for Distribution channel : "+e);

}

Former Member
0 Kudos

Hi Indrajit,


How will the rfc be triggered ? how will it no an error has been raised ?

Former Member
0 Kudos

Hi Zevik

Actually you have to provide the condition for triggering the RFC in message mapping. In other words this can handle only the errors which are relevant for message mapping.

For other error this will not work.

You can try the component based alerting

Michal's PI tips: Component-Based Message Alerting

This will return the alert message in a default format. If you see that the alert message has returned the file name some where you can try the below blog where you will parse the default message

and generate a specific format

I don't think we have any other option to do that.

gagandeep_batra
Active Contributor
0 Kudos

Hi Zevik:

i think yes you can send specific message details check below doc that may help"

Former Member
0 Kudos

Hi Gagandeep,

Iv'e got Pi 7.11 not Pi 7.31 so i can't use this.