cancel
Showing results for 
Search instead for 
Did you mean: 

Create MM alerts in Java Stack only

Former Member
0 Kudos

HI Gurus 

      I am doing migration of 7.1 to 7.4 (java Only) one of my interface needs to config the Alerts the alerts raised only when my message mapping will fail .could you please give me some suggestion how to install MM realted alerts in pi 7.4 java only stacks .

here i am attaching my payload in pi 7.1:

Alert ID: ##14076##

The details of the interface are:

Cause of the Alert: The first line of the file is not a header line

File Name: XXXXXXX_2013-10-28_10230AM.dat

Time of Execution: 10:25:52

Message ID: 9B065F0xXXXXX6890FD608B229

Sender Service: IXXXX_SERVER_CXXX

Sender Namespace:urn:XXXXXXX.com:XXXXX

Sender Interface: si_XXXXXXXX_XXX

Receiver Service: XXXXX_P_PRD_XXX

Receiver Namespace: urn:sap-com:document:sap:messages

Receiver Interface: PREQCR.XXXXXX

Above alerts is sample of pi 7.1 .i need to configure same in PI 7.4 ...

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi Ramanjaneya Reddy,

Basically you need to have the custom error message which needs to replicate the same in AuditLog.

it is a Single stack so it is required to enhance the UDF's bit.

1)Enhance the UDF and report the same with Message ID and Custom error message to jar file.

2)Add that jar file in the message mapping tab---?Funtions--->Archieves.

3)This jar file concatenate the custom error with Generic error message and which will come up with the alert.

Follow the below link for more information.

write mapping message to RWB audit log when ICO is used in PI 730

Writing Log Entries to Audit Log of the Message from Custom Java Mapping Program

Hope this will be useful.

Former Member
0 Kudos

Hi Ramanjaneya Reddy,

Basically you need to have the custom error message which needs to replicate the same in AuditLog.

it is a Single stack so it is required to enhance the UDF's bit.

1)Enhance the UDF and report the same with Message ID and Custom error message to jar file.

2)Add that jar file in the message mapping tab---?Funtions--->Archieves.

3)This jar file concatenate the custom error with Generic error message and which will come up with the alert.

Follow the below link for more information.

Hope this will be useful.

Harish
Active Contributor
0 Kudos

Hi Raman,

Please refer the below blog for component based alert in AEX

If you want to customized the alert then refer the below blog

regards,

Harish

Former Member
0 Kudos

Hi Harish

        Thanks for your quick reply ..i seen this blog  before my requirement was different

When Message mapping UDF fails then i raise the alert i need to catch file name dynamically need to add custom message as per below

Cause of the Alert: The first line of the file is not a header line

File Name: XXXXXXX_2013-10-28_10230AM.dat

Harish
Active Contributor
0 Kudos

Hi Raman,

for your requirement you need to create the customized alert. For customize alert you need to create one more interface. Please refer the below blog

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

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

regards,

Harish

abranjan
Active Participant
0 Kudos

Hi Ram,

Since you require Custom alert messages when your particular UDF fails, I think it can be handled from the UDF itself. You can try this:

1. Throw an exception from UDF based on your condition using following java statement:

    throw new StreamTransformationException("Your custom message");

2. Used CBMA (from links provided by Harish) and integrate this interface to receive alerts with above

message.

Regards,

Abhishek

Former Member
0 Kudos

Hi Ram

Since you want to trigger the alert from message mapping and based on the condition,

you need to use the function module SALERT_CREATE.

Since you are in single stack, you need to create the alert categories in SOLMAN.

Sample code for calling RFC SALERT_CREATE is given below

java.util.Map map;

try {

String msgid;

map = container.getTransformationParameters();

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

Channel channel = LookupService.getChannel("DE1XXX100","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);

}