on 12-31-2013 10:49 AM
Hi experts,
Is it possible to add to emails sent by pi alert monitoring specific message details.
Especially:
file name and time
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);
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Gagandeep,
Iv'e got Pi 7.11 not Pi 7.31 so i can't use this.
User | Count |
---|---|
96 | |
11 | |
11 | |
10 | |
9 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.