cancel
Showing results for 
Search instead for 
Did you mean: 

How to Raise Alert

Former Member
0 Kudos

Hello,

I have source structure

S1

I have target Structure

T1

S1 is mapped to T1

If T1 has value '10' I want to raise alert.

How can I do it

Regards

Accepted Solutions (1)

Accepted Solutions (1)

MichalKrawczyk
Active Contributor
0 Kudos

Hi Henry,

very easily:

1. open this blog by Bhavesh:

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

2. copy the code

3. add one if - If T1 has value '10' I want to raise alert.

4. and you're done

Regards,

michal

-


<a href="/people/michal.krawczyk2/blog/2005/06/28/xipi-faq-frequently-asked-questions"><b>XI / PI FAQ - Frequently Asked Questions</b></a>

Former Member
0 Kudos

Hello Michal,

Nice to hear from you

I am checking it. Can I have your email id where I can ask you things regarding alert!!!

Regards

MichalKrawczyk
Active Contributor
0 Kudos

Hi Henry,

>>>Can I have your email id

it's in my business card on SDN

>>>> I can ask you things regarding alert!!!

but please ask here - SDN as you will get much faster response then from my mail

as I'm on holidays

Regards,

michal

-


<a href="/people/michal.krawczyk2/blog/2005/06/28/xipi-faq-frequently-asked-questions"><b>XI / PI FAQ - Frequently Asked Questions</b></a>

Former Member
0 Kudos

Hello Michal,

I am seeing this blog by Bhavesh. I am not doing any lookup.

I am doing simple mapping (S1 ---T1)

So what user defined fn I have to write to raise alert.

Will your blog -- /people/michal.krawczyk2/blog/2005/03/13/alerts-with-variables-from-the-messages-payload-xi--updated

will help me in this

Regards

Former Member
0 Kudos

Hi

This is the UDF you have to write

import com.sap.aii.mapping.lookup.*;

import java.io.*;

// Business Service --BS_UDFALERT

// RFC Comm Channle -- CC_UDFALERT_RFC

Channel channel = LookupService.getChannel("BS_UDFALERT", "CC_UDFALERT_RFC" );

RfcAccessor accessor = LookupService.getRfcAccessor(channel);

String rfcxml ="<?xml version=\"1.0\" encoding=\"UTF-8\"?><ns0:SALERT_CREATE xmlns:ns0=\"urn:sap-com:document:sap:rfc:functions\"><IP_APPLICATION_GUID/> <IP_CAT>ALRTFRMWRKTEST</IP_CAT> <IT_CONTAINER><item><ELEMENT>DOCNUMBER</ELEMENT> <TAB_INDEX>0</TAB_INDEX> <ELEMLENGTH>250</ELEMLENGTH> <TYPE>C</TYPE> <VALUE>12345</VALUE> </item> </IT_CONTAINER></ns0:SALERT_CREATE>";

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

XmlPayload payload = LookupService.getXmlPayload(inputStream);

Payload rfcOutPayload = null;

rfcOutPayload = accessor.call(payload);

You are doing an RFC lookup within the UDF to trigger the alert

hope , it is clear

regards

krishna

Former Member
0 Kudos

Hello KrishnaMoorthy,

I am seeing this blog by Bhavesh. But I am not doing any lookup (RFC).

I am doing simple mapping (S1 ---T1)

and want to trigger alert when value in TI is 10.

Do I require to use RFC lookup in my UDF

Regards

Former Member
0 Kudos

Henry,

From ur mapping if u have to raise alert then u have to trigger this function module

SALERT_CREATE which Bhavesh is doing in the blog using RFC Look up

Instead u can also write a JCO call to the RFC directly but I think it is better way to have a RFC Communication channel and do RFC Lookup to trigger an alert

Regards

Kavitha

Former Member
0 Kudos

Do I require to use RFC lookup in my UDF

Exactly:)

You gotta get your hands dirty with some java

regards

krsihna

Former Member
0 Kudos

Hello Krishna,

Thanks !!!as you advised me that I need to write fn as given by Bhavesh.

Can you pls let me know where in this function I have to give condition for my value 10.

Regards

Former Member
0 Kudos

Hi

Just give you field as input to the UDF (as string) ,

Just check the for the condition using a simple "If" construct in java and then call the Lookupservice

regards

krishna

Message was edited by:

Krishnamoorthy Ramakrishnan

Former Member
0 Kudos

THello Krishna,

So I will use simple if condition.

If value is 10 then I will call that fn.

I have made Business Service and RFC Comm channel like that in Config Objects.

Do I need to change anything in that fn.

I have awarde you the points .

Thanks again

Regards

Former Member
0 Kudos

Henry

Check for the condition and just follow the steps mentioned in the blogs. You should be set

regards

krishna

Former Member
0 Kudos

I have awarded you the points .

Thanks for your suggestions!!!

Regards

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi

refer the following weblog

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

You can have an UDF which checks for the value and raises an alert accordingly

regards

krisha