cancel
Showing results for 
Search instead for 
Did you mean: 

Trigger alert on basis of certain field in interface

Former Member
0 Kudos

Dear Experts,

This is a concern regarding sending Alert to users by mail in XI.

IDOCs are reaching XI.The validations are not done in the Sender Side.

For a certain field of the IDOC, the permitted values are 2/3/4 . If user passes some other values or a blank value , an Alert mail needs to be triggered .

We have succeeded in sending alert for failure of a particular Interface, but we have no idea , how to read certain field of a message interface and how to trigger the alert on that basis.

Please suggest.

Regards,

Navneet

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

We have succeeded in sending alert for failure of a particular Interface, but we have no idea , how to read certain field of a message interface and how to trigger the alert on that basis.

For raising an alert you need to first configure the alert please follow the below weblog written by Michal Krawczyk

/people/michal.krawczyk2/blog/2005/09/09/xi-alerts--step-by-step

Configuration steps are: go to transaction ALRTCATDEF

1) Define Alert Category

2) Create container elements which are used for holding an error messages.

3) Recipient Determination.

Raise an alert after checking whether the data 2/3/4 using the below method. all has to be done inside ur mapping..

1) Triggering by Calling a Function Module Directly.

/people/bhavesh.kantilal/blog/2006/07/25/triggering-xi-alerts-from-a-user-defined-function

chirag

Answers (4)

Answers (4)

GabrielSagaya
Active Contributor
0 Kudos

Hi

You can trigger the exception explicitly by using

throw new RuntimeException("This occurred to trigger an alert");

You can simply configure alerts in ALRTCATDEF and it should trigger the alert.

/people/michal.krawczyk2/blog/2007/04/26/xipi-throwing-generic-exceptions-from-any-type-of-mapping

/people/alessandro.guarneri/blog/2006/01/26/throwing-smart-exceptions-in-xi-graphical-mapping

/people/bhavesh.kantilal/blog/2006/07/25/triggering-xi-alerts-from-a-user-defined-function

Have a look on Bhavesh Reply also

GabrielSagaya
Active Contributor
0 Kudos

you can use udf

package com.guarneri.xi.mapping.udf;

public class CustomMappingException extends RuntimeException {

public CustomMappingException() {

super();

}

public CustomMappingException(String message) {

super(message);

}

public CustomMappingException(Throwable cause) {

super(cause);

}

public CustomMappingException(String message, Throwable cause) {

super(message, cause);

}

}

Throwing Smart Exceptions in XI Graphical Mapping

/people/alessandro.guarneri/blog/2006/01/26/throwing-smart-exceptions-in-xi-graphical-mapping

Use a UDF to throw the alert. Have a look at Bhavesh's weblog on how to do this.

/people/bhavesh.kantilal/blog/2006/07/25/triggering-xi-alerts-from-a-user-defined-function

package com.guarneri.xi.mapping.udf;

public class ExceptionThrower {

public static void fire(String message) throws CustomMappingException {

throw new CustomMappingException(message);

}

}

Here the UDF will throw if the input a has blank or does not contain permitted value 2/3/4

imports com.guarneri.xi.mapping.udf;

function myudf(String a, Container container)

{

if (a.length==0 || a.trim().length()==0)

ExceptionThrower.fire("Blank input");

int num[]={2,3,4};

int flag=0;

for(int i=0;i<num.length;i++)

{

if (a!=num<i>)

flag=1;

}

if (flag==1)

ExceptionThrower.fire("Permitted values are 2/3/4");

else

return a;

Former Member
0 Kudos

Dear Gabriel,

Thanks a ton for your reply.

I had a idea about crating a UDF and triggering the exception. But can you plz elaborate, how to transform this exception into an Alert message through Alert Configuration?

Regards,

Navneet

Former Member
0 Kudos
Former Member
0 Kudos

Hi,

/people/michal.krawczyk2/blog/2005/09/09/xi-alerts--troubleshooting-guide

https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/60c24b82-6da9-2a10-5a93-f1f729d8...

Hope it is helpful........

Thanks,

Madhu