Additional Blogs by Members
cancel
Showing results for 
Search instead for 
Did you mean: 
Former Member

Hello Everyone. Here I am providing the steps to get the alerts in your Alert Inbox from BPM. I have tried to cover each and every step required for this,
so that even the beginners will get to understand the concept better.

This blog explains the usage of

Multiline Containers of the Alert Categories

and the User Defined Function that will populate the Containers.

The main purpose of using Multiline containers is to extend the length limitation of 130 Characters as with Dynamic messages.

There are two ways to get an Alert Message :


1.

Dynamic Message :

Alert Message will be the Dynamic Message that will be specified in the BPM control step.

• In the BPM, use the Control step to trigger the alert in error branch and specify the Alert Category and Alert Message.

Limitation: The message can’t be longer than 130 char.

2.

Container Message :

Alert Message will be the message specified in the ABAP stack using the container values.

• Using the Multiline container in Abap stack, we can overcome the limitation of message length.
• From a User Defined Function calling the RFC “screate_alert” to fill the containers and the alert message will formed , as described in the category
long text using these container values.

We will see the Second Approach in Detail.

Implementation :

I) ABAP side settings

1.1. In transaction ALRTCATDEF, create an Alert Category.

1.2. Define the Containers. There will be two containers:

1.     XI_ERROR_SUBJECT: Alert title

2.     XI_ERROR_MESSAGE (Multiline): Alert Description

3.      Add the respective containers to the Long & Short Text tab.

4.     Add recipient’s name to the Categories. Only these users will be able to see the alert in their inbox.

5.     In the Runtime workbench Create rules for the category defined.Goto RWB->AlertConfiguration->Select ur AlertCategory->Add Rule.

II)BPM Steps

Let’s take an example where we have to catch the Value Mapping Errors or the BAPI Errors. The Complete error message needs to be displayed in the Alert.

BPM will be used here. A User Defined Function is used to catch all the errors. All those errors will be passed to the Multiline Containers, by executing a RFC within that UDF. The UDF is responsible for triggering the Alert .After the Alert trigger, process is cancelled.

The BPM will look like this:

III) UDF Specification



A UDF will be called in the Mapping used for Transformation step. The following function will be called from UDF .The code is:

+public static void triggerAlert(String alertSubject,String[] alertMessage)
{
String strAlert = new String();
String strAlertXML = new String();
ArrayList returnStr = new ArrayList();


// split message if length more than 132.
String newAlrtMsg = new String();
int j=0;
for (int i = 0; i < alertMessage.length; i++){
newAlrtMsg = alertMessage[i];
try{
while(newAlrtMsg.length()>130){

                              newAlrtMsg = newAlrtMsg.substring(130);

                         j++;

strAlertXML = "<item><ELEMENT><b>XI_ERROR_MESSAGE</b></ELEMENT><TAB_INDEX>"(j)"</TAB_INDEX><ELEMLENGTH>255</ELEMLENGTH><TYPE><br>C</TYPE><VALUE>" newAlrtMsg +"</VALUE></item>";                         

                         }

j++;

strAlertXML = "<item><ELEMENT><b>XI_ERROR_MESSAGE</b></ELEMENT><TAB_INDEX>" (j)"</TAB_INDEX><ELEMLENGTH>255</ELEMLENGTH><TYPE><br>C</TYPE><VALUE>" newAlrtMsg + "</VALUE></item>";

     }catch(Exception e){System.out.println(newAlrtMsg""e.getMessage());}

          }

try {

                //Calling Alert RFC SALERT_CREATE

          Channel channel = LookupService.getChannel("”strAlertXML

LongText will have all the error descriptions.

7 Comments