cancel
Showing results for 
Search instead for 
Did you mean: 

Raise Alert and also Execute the message

former_member192105
Participant
0 Kudos

Hello,

I have a requirement to raise an alert if a particular message is processed in SAP PI and also this particular message is to be send to the intended receiver.

The main intention is to inform the Support Team that a particular message is processed from SAP PI without hampering the flow.

How should this be done?

I know how to configure alerts in ALRTCATDEF; so no links on this!

~Thanks.

Accepted Solutions (1)

Accepted Solutions (1)

former_member187339
Active Contributor
0 Kudos

Hi Abhishek,

>>I have a requirement to raise an alert if a particular message is processed in SAP PI and also this particular message is to be send to the intended receiver.

Do you want to send an alert for a successful message? Alert can only be raised for error/failed messages. So if you want to send an email then you need to configure it as a separate scenario and not as an alert

Regards

Suraj

former_member192105
Participant
0 Kudos

Hello,

Yes, I know that we can raise alert only when something goes wrong in SAP PI.

The scenario is HTTP -> SAP PI -> IDOC. I have to perform check on HTTP message (check if some field has required value or not). If this validation fails then I have to generate another message (from SAP PI itself) and send it to ReceiverX.

In case of validation failure no IDOC should be created.

So I am supposed to raise an alert as an indication that validation has failed (but the message processing has not).

I cannot go for Mail adapter as the above approach is to be implemented in many scenarios and adding one more flow to each of the scenarios may not be approved by the business. Hence I was looking for some common solution.

~Thanks.

Former Member
0 Kudos

Hi,

You can write a UDF to raise the ALERT, and make it as a functional Library.

Now in any message mapping during validation if condition fails, call this UDF else not.

Hence when ever the validation fails it will raise an ALERT only not an exception

Babu

Former Member
0 Kudos

Hi,

If you want to raise an alert in case of some validation failure like as you mentioned then look for RFC lookup where you can call an RFC SALERT_CREATE_API for triggering an alert via UDF ..

If you are sure that the second message is going to be triggered only in case of validation failures then in that mapping use this RFC lookup for Alerts ...

HTH

Rajesh

former_member192105
Participant
0 Kudos

Hello Babu and Rajesh,

Thank you for the workarounds!

I did some search and found the below relevant blogs for your comments:

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

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

I have some doubts:

1) In blog- 3069 it is mentioned that the whole mapping will be stopped; now does this mean that the message will not be delivered to the Receiver? (I think it will not)

2) In blog- 6398 the screenshots show that the message processings are reported as error (Red Flag); will this also mean that message will not be delivered to the Receiver (as the mapping has stopped)?

~Thanks.

former_member192105
Participant
0 Kudos

Hello,

I think I looked at the wrong blogs!

I got this one: /people/bhavesh.kantilal/blog/2006/07/25/triggering-xi-alerts-from-a-user-defined-function

~Thanks.

former_member192105
Participant
0 Kudos

Hello,

I have some doubts regarding SALERT_CREATE_API:

1) Where will this RFC be developed (on SAP ECC or in SAP PI)?

I could see it in SAP ECC but not authorized to view SE37 in SAP PI.

2) Do I need to import this RFC into SAP PI? (if RFC is on SAP ECC)

3) As I am using SAP PI 7.11 will this work if I use the standard function (RFCLookup) available in Message Mapping?

Since this is the first time that I am working on lookup I have so many (and so basic) doubts; hopefully the Experts dont mind.

~Thanks.

former_member187339
Active Contributor
0 Kudos

Hi Abhishek,

>>1) Where will this RFC be developed (on SAP ECC or in SAP PI)? I could see it in SAP ECC but not authorized to view SE37 in SAP PI.

It is not developed, it is a standard one and need to be there in SAP PI (Since you will be calling it from Mapping)

>>2) Do I need to import this RFC into SAP PI? (if RFC is on SAP ECC)

No need to import, as it should be there

>>3) As I am using SAP PI 7.11 will this work if I use the standard function (RFCLookup) available in Message Mapping?

RFC Lookup is not used in this case, as you need to raise an alert from mapping.

Regards

Suraj

former_member192105
Participant
0 Kudos

Hello,

Thank you for the reply.

I am trying to implement the logic in this blog: /people/bhavesh.kantilal/blog/2006/07/25/triggering-xi-alerts-from-a-user-defined-function

The author has mentioned the use of RFC Lookup to call the SALERT_CREATE. I am using this approach as it is mentioned in the blog that We brought down our JMS service and the Alert was triggered successfully, and the business flow of the interface continued without any hassles.

Please suggest if I should follow some other approach.

~Thanks.

former_member187339
Active Contributor
0 Kudos

Hi Abhishek,

>>The author has mentioned the use of RFC Lookup to call the SALERT_CREATE.

Yes you can use it.. Make sure you pass and collect the parameters in the correct order. Also the mapping logic should be created in such a way that when get back a response(successful) from the RFC, the IDOC header should be suppressed (so that no idoc is created)

Regards

Suraj

former_member192105
Participant
0 Kudos

Hello,

Make sure you pass and collect the parameters in the correct order.

What are the parameters? I want to execute the Lookup (i.e. raise an alert) whenever the mapping is executed. IDOC is used in some other mapping.

I am planning to use the UDF as (will this work):

Source_Root_Node -> UDF -> Target_Root_Node

If I look at the UDF (in the blog) I do not find anything is passed or retrieved from it. Is my understanding correct?

Also as the RFC is present in SAP PI itself, I should mention the details of SAP PI in the RFC receiver channel?

~Thanks.

former_member187339
Active Contributor
0 Kudos

Hi Abhishek,

First both Alert logic and IDoc creation should be in the same mapping,so that if your condition is not satisfied then an alert is raised (instead of creating the IDoc) and the Idoc is suppressed

Second. if you check the blog, you have some parameters like

1.IP_CAT - Alert Category created in ALRTCATDEF ( ALRTFRMWRKTEST)

2.IT_CONTAINER -

This is used to fill up the Container Variables.

ELEMENT u2013 The name of the container variable. (DOCNUMBER)

ELEMLENGTH u2013 Length of the Element (250)

TYPE u2013 Type of the Container variable ( C for character)

VALUEu2013 Value to be passed. (12345)

these need to be set, before you call the RFC, then only an alert will be triggered.

>>If I look at the UDF (in the blog) I do not find anything is passed or retrieved from it. Is my understanding correct?

Check the parameter String rfcxml in the code, there the values are set.

>>Also as the RFC is present in SAP PI itself, I should mention the details of SAP PI in the RFC receiver channel?

Yes

Regards

Suraj

former_member192105
Participant
0 Kudos

Hello,

I have the target structure like:

<Response>

-<Detail>Constant Value</Detail>

-<Error> 0..unbounded

--<ErrorCode>Constant Value</ErrorCode>

-</Error>

</Response>

Mapping for Error node is:

SourceNode -> exists -> if (then) -> Error

Now I want to use the UDF after if-condition like:

SourceNode -> exists -> if (then) -> AlertUDF -> Error

The UDF has two input parametrs - the output of if-condition and the other a Constant.

I want to know if the UDF in blog# 4077 will be executed even when the output of if-condition is false? I want to execute the UDF only when the if-condition returns true (in above case when SourceNode does not exists).

~Thanks.

Edited by: Abhishek01 on Feb 10, 2011 6:42 AM

former_member192105
Participant
0 Kudos

Hello,

Mapping of the UDF is solved.

I want to know about container variables to be used in the ALRTCATDEF and also in the UDF.

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

<IT_CONTAINER><item><ELEMENT>DOCNUMBER</ELEMENT> <TAB_INDEX>0</TAB_INDEX> <ELEMLENGTH>250</ELEMLENGTH> <TYPE>C</TYPE> <VALUE>12345</VALUE> </item> </IT_CONTAINER>

The above helps in filling the container variable DOCUMENT.

Now I want to know, if I have to define DOCUMENT somewhere other than the UDF?

~Thanks.

former_member187339
Active Contributor
0 Kudos

Hi Abhishek,

>>Now I want to know, if I have to define DOCUMENT somewhere other than the UDF?

I am not able to see any DOCUMENT in the udf. Did you meant <ELEMENT>DOCNUMBER</ELEMENT> , just create the xml structure as shown in the blog and test your interface.

Regards

Suraj

former_member192105
Participant
0 Kudos

Hello,

*Did you meant <ELEMENT>DOCNUMBER</ELEMENT> *

Yes it is DOCNUMBER, mistook it as DOCUMENT!

just create the xml structure as shown in the blog and test your interface.

Yes I have written the UDF with the similar xml structure.

I think, the author defined DOCNUMBER in ALRTCATDEF and then used it in the alert message *Alert Mechanism from UDF Long Text &DOCNUMBER& *

Is my understanding correct.

If not then how was the message Alert Mechanism from UDF Long Text 12345 displayed in the Alert Inbox?

~Thanks.

former_member187339
Active Contributor
0 Kudos

Hi Abhishek,


I think, the author defined DOCNUMBER in ALRTCATDEF and then used it in the alert message *Alert Mechanism from UDF Long Text &DOCNUMBER& *
Is my understanding correct.
If not then how was the message Alert Mechanism from UDF Long Text 12345 displayed in the Alert Inbox?

Yes your understanding is correct.

Regards

Suraj

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Abhishek,

I think the requirement can be achieved. Follow the blog /people/bhavesh.kantilal/blog/2006/07/25/triggering-xi-alerts-from-a-user-defined-function - Triggering XI Alerts from a User Defined Function. This will trigger an alert when the validation fails. Use multi-mapping at receiver ie. the second structure is the message needs to be sent to the receiver when the validation failes.

Ref: /people/jin.shin/blog/2006/02/07/multi-mapping-without-bpm--yes-it146s-possible

Hope this helps you.....

Thanks,

Former Member
0 Kudos

Hi,

This sceanrio can be achieved using Mail adapter instead of Alert..

Configure one more receiver in receiver determination and ensure maintain order at runtime is checked(ofcourse bt default it will be selected..) this will ensure that an email will be triggered only when message has been executed..

If any failure occurs in your message then this will lead to the blocking of queues which will not send an email to the receipent..

once you clear the error message then the email can be triggered..

HTH

Rajesh.P