Create your own auto-reaction messages in Business Process Monitoring via BAdI exit
Business Process Monitoring (BPMon) aims to monitor your most critical business processes and interfaces in an automated way. Alerts can be created on critical incidents in almost every part of your SAP landscape. See the Functional Scope of Business Process Monitoring in SAP Solution Manager of Volker von Gloeden to get a first impression on BPMon in general, and to find links to more detailed information on specific topics within BPMon.
One main advantage of the BPMon concept is that alerts are not only created and displayed in the SAP Solution Manager system. But that you can assign automated auto-reaction messages like sending an e-mail, SMS, or Service Desk Message to the responsible persons for every alert that is triggered within the Business Process Monitoring session. The standard alert notification in BPMon contains basically all technical context information of the alert (like the business process, the business process step, and the SID of the system that is affected) and the alert message text itself (which contains among others the key figure information, the timestamp of the alert, and the measured value).
However, for some customers this information is not sufficient enough. Either they want to determine the recipients of a certain alert in a more sophisticated way (e.g. depending on the criticality of the alert), or they want to include more (business) context-specific information (like adding the document numbers of the erroneous application documents to the long text of the message). For such cases the BPMon framework offers a BAdI exit that enables you to enrich the standard alert messages with customer-specific information or even to create own-defined messages from scratch.
Where can I find the BAdIs?
Basically, what you need is the EhP 1, SPS23 on your SAP Solution Manager system. Then the two parts that are necessary to use the new functions are available: an updated BPMon Setup session (which is contained in ST-SER 701_2010_1), and the corresponding Enhancement Spot where the BAdIs are located (contained in ST 400 SP23). Just call package DSWP_BPM in transaction SE80 and navigate to Enhancements -> Enhancement Spots -> ENH_SPOT_DSWP_BPM_NOTIF to find all the BAdIs related to Business Process Monitoring notifications.
Which BAdIs are available?
We offer two different kinds of BAdIs: either you can adjust the existing message by adding own content, and the message will then be sent out via the standard BPMon notification mechanism (via transaction SCOT or SAP Service Desk). Or you can create a completely new message which means that you also have to take care of the creation and sending of the message by yourself. Both functions are available for e-mails and for SAP Service Desk messages:
BADI_BUILD_MESSAGE: enrich existing BPMon e-mail
BADI_BUILD_SUPNOTF: enrich existing SAP Service Desk message
BADI_CUSTOM_MESSAGE: create e-mail from scratch
BADI_CUSTOM_SUPNOTIF: create SAP Service Desk message from scratch
In addition, a fifth BAdI (BADI_BPMON_ALERT_CONFIRMATIO) exists that provides an interface with which you can trigger any extra action every time you confirm an alert in the BPMon session.
How to create a BAdI implementation?
Well, this is nothing specific to the BPMon BAdIs hence I will keep this short. BAdI implementations can be created via the BAdI Builder (transaction SE18). The logic to be implemented later on is just simple ABAP coding that you apply in the corresponding method. Please have a look into the BAdI documentation available in SAP Help if you need more general information.
Only one thing that is important to mention here: you can apply filter values for your BAdI implementation which can then be used in the BPMon Setup session to further specify the messages to be sent out. This enables you to use different BAdI implementations for different Monitoring Objects, meaning you can send out specific messages for almost every alert independently.
Now let’s give you a short example on how a possible BAdI implementation could look like.
Imagine you are monitoring workflows within your Order to Cash process. Any failures are normally handled by your own application team located in EMEA. However, as the Business Process is running 24/7, and the workflows are a critical step within the data flow, incidents have to be corrected as soon as possible. Thus, a second team located in US is responsible for reacting on alerts that are triggered during EMEA night time. As soon as a critical (red) alert is raised in the BPMon session an SAP Service Desk message should be created that is filled with shift-specific information.
In the BPMon standard it is not possible to realize such a requirement. But you can use BADI_BUILD_SUPNOTF to define shift-specific messages which contain different contact persons for escalating the issue within the long text of the SAP Service Desk message.
First step will be to maintain the parameters for the SAP Service Desk Message in the BPMon Setup session. What you basically have to provide is
The processor: Who should work on the SAP Service Desk message?
The threshold values: When should an SAP Service Desk message be created?
The type of message: Will a standard SAP Service Desk message be created (which still can be enriched via BAdI implementation), or should a customer-defined message be sent out?
In our case we decide to have an enriched SAP Service Desk message. Thus, beneath the information on the processor, the customizing in the BPMon Setup session could look like the following:
In this case an SAP Service Desk message will be sent out automatically as soon as one red alert is created in the BPMon session, and this standard message will be enriched by the content of the implementation BADI_BUILD_SUPNOTF which is identified by the filter value “DAY_NIGHT”.
In order to get the shift-specific content into the long text we now have to create a corresponding implementation for BADI_BUILD_SUPNOTF. Let’s name it Z_BADI_DAY_NIGHT_SUPNOTF. We also define a filter value “DAY_NIGHT” in order to distinguish it from other BAdI implementations that we plan to have for other Monitoring Objects within our solution:
Now the BAdI logic can be applied in the corresponding method which in this case is called IF_EX_DSWP_BPM_BUILD_SUPNOTIF~BUILD_SUPNOTIF. We apply a generic subject text for the SAP Service Desk message, but the long text will be individual for both shifts. In both regions different second level support teams are available which can then be contacted if the problem cannot be resolved by one of the recipients of the SAP Service Desk message.
In the end an SAP Service Desk message like the following is created:
This example, as well as a complete description on how to set up auto-reaction messages in BPMon, and to implement and work with BAdIs in the BPMon environment, can be found in the “Setup Guide – Auto-Reaction Messages” which is available on SAP Service Marketplace, alias BPM (http://www.service.sap.com/bpm -> Media Library -> Technical Information).
we use BPMon IDoc-Montoring of SolMan for incoming IDoc's of SAP-ERP. The standard e-Mail message is not so helpful!
Now I try to expand the e-Mail with BadI BADI_BUILD_MESSAGE. How can I get detailed informations out of the alerted Idoc's???
If I open the "deatil info" of an alert, it's possible to show with button "content view" values of defined fields. This information I want to fill in the e-Mail and also the Idoc-number.
Is it possible to debug the BadI to see the available data of the interface?
for both of your questions the answer is not so easy. The IDoc numbers of the alerted IDocs are stored on the managed system; when you call the detail info then based on these IDoc numbers further details are read from DB in order to build up the Error and the Content View. The BAdI execution, however, takes place on Solution Manager side only. So what you have to do is to call the managed system out of the BAdI implementation, get the IDoc numbers that were alerted, and give back further IDoc details to Solution Manager to enrich the notification. But it doesn't make sense to use the detail info for that purpose. Since ST-A/PI 01N we have a subroutine IDOC01_GET_IDOCNO_FROM_PTAB in program /SSA/EIM that extracts the IDoc numbers for a certain alert from the managed system. If you don't have ST-A/PI 01N yet I can't offer you a good solution here, as deeper knowledge of the underlying data model is required.
Debugging the execution of a BPMon BAdI implementation is somehow complicated, as the BAdI will only be triggered when an alert is due. And only in that case the interface parameters will also be filled with reasonable values. So describing how you can access the coding part in the BPMon infrastructure won't help you much. About which import and export parameters are you unsure? Maybe I can give you more input here.
thanks for your fast answer.
Today we have ST-A/PI 01M_CRM570. I think first we will update our SolMan to actual releases and then I use the subroutine IDOC01_GET_IDOCNO_FROM_PTAB.
Debugging - sometimes it's easier to debug a report to find out the available data. Here I have to fill all available data into the e-Mail. It's a little bit circuitous, but ok.
We are using BADI exit for customized email message.That is working fine.But now the user wants the "Detail Info" contents also to be emailed as an attachment along with the alert mail.
Ex"I have alerts for incomplete sales documents in my BPM.I wanted to know if this content(List of all open sales documents) can be emailed as an attachment along with the email notification sent to the users.This way the users need not log into solution manager at all for viewing the documents.They can just view the list of incomplete sales documents in the email if it is possible to send them in an excel .
I'm afraid to say that currently there's no such feature available in SAP standard that would allow you to include the contents of the "Detail Info" into the alert notification. The only way is to fill that data via implementing the BAdI - but unlike the IDoc monitor where there is some way to get the IDoc numbers out of the managed system (see my last post), the application key figures (like for SD) doesn't offer such an exit.
Currently we're working on improving the alert notification process - probably this will also include an easy way to access the contents of the "Detail Info". But this is work in progress - so please understand that I can't share more details with you at the moment.
Thanks for replying !! It will be good if SAP provides an option to email the detail info contents as most of the users wanted to see the details in the mail itself. Hope this is added in the new feature.
since a few days we have ST-A/PI 01N. Now I try with form IDOC01_GET_IDOCNO_FROM_PTAB in program /SSA/EIM to get idoc-data into my mail-text. But it is not running. Problem is form PTAB_READ_TABLE in program /SSF/ULIB - can not find data in table /SSF/PTAB for my alert.
I've created a test-report (for debugging) with perfom IDOC01_GET_IDOCNO_FROM_PTAB in program /SSA/EIM and the data, which are available in BADI_BUILD_MESSAGE.
Hope you can help me.
of course it depends on how you call the subroutine (with which timeframe), and it also requires that IDoc data is available in the BPMon table. Please understand that I can't provide you a detailed analysis here as your request relates to a consulting problem. If you feel that the subroutine itself works wrong please open a customer message on component SV-SMG-MON-BPM. Otherwise I would ask you to follow the guidelines in SAP note 83020 in order to request a proper consulting resource.
Thanks for your understandig.
Hi Thomas , i am also having the same issue with implementing the badi
have you managed to get it correct
if so please can you assist me further
whats i have so far is the badi is implemengted and the filter value is defined in customizing on solman 7.1
i get the email but the contents of idoc number etc are not part of the email body
BPmon is also creating a CCMS monitor in RZ20. It seems to be possible to use existing CCMS autoreactions with the MTE's created. Can you tell me if this can lead to problems and if this is supported by SAP?
from a technical point of view this will be possible. However it is not recommended to do so as whenever changes take place in the BPMon setup, after activation new nodes for the new monitoring objects will be created and old nodes will disappear. It will be very hard to keep the assignment of auto-reaction methods to these dynamic changes in CCMS up to date.
If you do so this will be a custom replacement for the standard notification mechanism BPMon offers - unfortunately we can't support you here (except via consulting).
Thanks for your reaction. When an autoreaction is assigned at MTE Class level they will stay active even after the activation of new nodes. I am using ccms alerts to send alerts to the alert framework. Do you know if this will be a default autoreaction for BPMon as well?
not sure if I understand your question. Do you mean that the BPMon standard notification mechanism also connects to the alert framework and create alerts there? Then the answer is no. If you like to connect to the alert framework then also a notification BAdI has to be implemented that sends the BPMon alert to ALM.
If you mean that the CCMS nodes for BPMon already contain a default auto-reaction, the answer is no, too. Per default, these MTEs don't contain any methods.
my requirement is to send alert notification mails to different persons responsible for different shipping points for different key figures (for eg.in business process Order to cash, for outbound delivery created key figure, if at shipping point CA37, person A is responsible, then the alert mail should be triggered to him. similarly for other persons, mails should be sent whenever there are alerts for their respective key figure n shipping point.) For this purpose, i am using BADI_CUSTOM_MESSAGE. I have done all the configuration in BPMON and used correct name of filter in BADI implementation too, but the importing table pt_alerts of badi is empty and there are no mails getting triggered for my monitoring object. Please let me know if my requirement is feasible or not. if yes, how should i proceed.
Thanks & regards,
Is it possible to send an alert/incident to other ticketing tool like remedy ot Netcool . Please suggests.
yes, it's possible via BAdI BADI_CUSTOM_SUPNOTIF. Please check the "Setup Guide - Automatic Alert Notifications" (SolMan 7.0 or 7.1 version), chapter 8, for details. You can find it at www.service.sap.com/bpm -> Media Library -> Technical Information.
can you please suggest . how can i get below parameters in badi BADI_DYN_INCI_NOTIF_MULTIPLE?
SOLUTION(50) TYPE C: the solution you're are working in
MONID(20) TYPE C: the Monitoring ID of the monitoring object
ALERTTYPE(10) TYPE C: the alert type (consisting of technical name of the monitoring object and the key figure)
ADATE(8) TYPE N: the date under which IDocs are stored in BPMon cluster table for this specific alert
ATIME(6) TYPE N: the corresponding time
COUNTER TYPE I: the counter of the key figure.
i need to implement this for creating custom alerts for erroneous IDOCS