Skip to Content

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

image

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

image

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

image

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

image

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:

image

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.

image

To report this post you need to login first.

7 Comments

You must be Logged on to comment or reply to a post.

    1. Anonymous
      Hi Bhavesh

      The longText can have any of the following:
      1.&XI_ERROR_MESSAGE& :This will display only the first line of multiline container
      2. &XI_ERROR_MESSAGE[]&  :This displays complete message without line break.
      3. &XI_ERROR_MESSAGE##& :Display Text with Line Break i.e Each row of multiline container will be a new line Alert Message.

      Eg: If XI_ERROR_MESSAGE[0]=”A”,XI_ERROR_MESSAGE[1] =”B” , then output will be
      1.&XI_ERROR_MESSAGE& : A
      2.&XI_ERROR_MESSAGE[]& : AB
      3.&XI_ERROR_MESSAGE##& : A in forst line and
                               B in next line

      Regards
      DhanyaR Nair

      (0) 
    1. Anonymous
      Hi Gordon

      we r using the UDF for alerts. So u have to use the UDF while mapping the fields that may get into error.For eg if you have a field like Plant in your source and target messages,The source plant needs to be value mappedto get target plant.In this case u map this fields with UDF and within UDF – u have to do the valuemapping and in case of exception, u have to pass the incorrect plant in alert message.I have provided the code  to pass the error messages for alert trigger.

      Let me know,if this clarifies ur doubt.
      Regards
      Dhanya

      (0) 
  1. Jonathon Marston
    Please correct me if I’m wrong, but it appears that you are getting the exception text from inside the exception branch and passing it to the UDF inside a message mapping – how do you do this? I cannot seem to find where the exception information is stored to pass it into a transformation step.
    (0) 
    1. Dhanya Nair Post author
      Hi Jonathon,

      The scenrio which i mentioned here , has to call a BAPI .
      The process i followed:
      1. I called the BAPI directly , if it gets into some exception (in conditions like :Bapi inputs are incorrect), then it gets caught in the exception block.
      2. In the exception block , I will actually check for each input. If the inputs are not proper, i took them into an errormsg array.
      3.I then passed this array to the RFC which triggers the alert.

      So, i have the exception msg in exception block with the UDF.

      Hope it clears ur doubt.

      Regards
      Dhanya

      (0) 

Leave a Reply