Customize Email Subject in Solman 7.1 using BADI
Customize Email Subject in Solman 7.1 using BADI
Goto transaction SE19
Enter ALERT_REACTION which is the enhancement spot for the BADI BADI_DYN_INCI_NOTIF.
Click on Create Impl.
Enter a name for the Enhancement Implementation – ZALERT_REACTION_BADI
Enter the Short Text – BADI Implementation for Custom Email Subject in Technical Monitoring
Press Enter
Specifiy the package name
Press Enter or click on Save to create a transport request
Press Enter to save the object in the Request
Press Save again to save another object in the package
Press Enter again to save the object in the Request
Enter a Custom (Z) name in the space for BAdI Implementation & Implementation Class.
Select BADI_DYN_INCI_NOTIF from the dropdown in BAdI Definition.
Press Enter
Click on Copy Sample Class
Enter the package details and Save
Save the object in the Transport Request
You’ll now see the main Enhancement screen.
Double-click on Filter Val to specify the filter used by the enhancement.
Click on Combination to create an empty entry. Then click on the ???? entry and press the Filt. Val.
Select EXTERNAL in the Value 1 field (this is the only available value) and press enter.
You can now see the Filter Value with EXTERNAL.
Now double-click on Implementing Class
On the right window, double-click on the Method – IF_ALERT_DYN_CONFIGURATION~GET_NOTIF_CONF_FOR_ALERT (usually the first entry in the list)
Click Yes
Copy the code below, between the method and endmethod.
DATA lv_mon TYPE string. lv_alert = io_alert_object->if_alert_consm_object~get_name( ). IF io_alert_object->IF_ALERT_CONSM_OBJECT~GET_RATING( ) = ‘2’. CONCATENATE lv_rating ‘ : ‘ lv_mon ‘ : ‘ lv_alert INTO e_email_subject.
|
Save the code and activate
Go back one screen to the main Enhancement screen and activate the Enhancement.
The emails will be adapted to the new format immediately.
The above code displays the following –
Alert Rating – RED/YELLOW
Managed Object Name – SID~ABAP etc
Alert subject text – This is the standard alert header
- E.g Email
hi,
Thanks a lot for the wonderful sharing!!!
Now please restrict your document access. We the users are able to edit the blog... even delete too..
please check.
Regards,
Jansi
Hi Jansi , hope you are well
i am finding a little difficulty with the following
i am setting up Red Alert for Idoc in status 51 inbound , i want the notificaqtion to be sent via email the moemnt the systems picks up an alert even if only one was raised , my problem is that i have set the threshol Red > 1 but this means if 1 alert is raised it is shown as green in the Alert box
Thanks
ravi
Hi,
Great documents,
Regards
Naor
Hi,
perfect thing!
Do you know or the other gues how can I suppress the E-Mail attachment the html page?
Best regards
Thomas
Hi Thomas,
not 100% sure on this and never had to explore this....
ask your developers to check how to overwrite a dummy value to variable ET_ATTACHMENTS which is of TYPE CL_DSWP_NA_NOTIF_ADMIN=>DSWPT_NA_EMAIL_ATTACHMENT.
I am not a developer, so don't know.
Regards
Deepak
Hey Thomas
Based on Deepak's answer, I followed somewhat deeper and found the creation step of the attachment in CL_DSWP_NA_NOTIF_ADMIN=>GET_NOTIFICATION_CONTENT defined as "CALL METHOD lo_ref_to_html_gen->create_html_alert_group" (line 57). As the referenced class does not seem to implement any interface, the most easiest way would be to edit this class adding a line like "lv_xtring = NULL." after line 67...
Perhabs there will be a more supported way - but this should work, too...
Greets, Michael
Hi Deepak , nice blog , is there something easy i can follow to implement the badi for the Body text of the notification email . i want to also send the user the info on error 51 IDOCs alerts
Thanks
Ravi
Hi Ravi,
I'd suggest you look at the IDOC monitoring through Business Process Monitoring.
This will give you more options on monitoring and even alerting.
Deepak
Hi,
Good one.
Thanks,
Karthik
Hi All
i have implemneted and activtaed the BADI_BUILD_MESSAGE with a new functional module defined as well
in customizing on Solman i have entered the Filter name in the field for the badi
i have left the subject Text and Template for Notification ling text blank
when the alert is raised the email is generated BUT the Subject is totally differnet and there is no body text ..
Please can some assist as this if very confusing
Ravi,
Have you implemented the BADI program exactly like the one I have posted in the doc?
If yes, then you should get the text you defined in the BADI program.
Please check again.
Deepak
Hi Deepak
Thanks for the reply
maybe i should explain a little more what i am trying to achive and then perhaps you could assist
i amtrying to customize my email subject line and the additional text in the long text box of the notification setup
simply i need a specific sugbject text and
some data values relating to the Alerted object (in this case incoming Idoc errors with status 51) thes values are in the managed system from table EDIDS (idoc number, and error text details (STATXT , STAPA1,STAPA2,STAPA3,STAPA4 etc)
i did assign the Badi a Filter value (less than 10 char and input this value in the customizing of the notification setup in BPmon setup)
hope this gives more insight into what i am strggling with
thanks
ravi
Dear Deepak,
do you know how to customize e-mail notofication body text?
If yes, could you please explain step-by-step?
Thanks a lot,
Alexander
Hi Alexander,
Not sure if you would still need a reply but I'm writing it here for the benefit of others who are looking for the same.
There is an official reference implementation code by SAP which can be used as a base for your specific customization. The code has comments to explain you what each block does. Please access the documents here.
Alert Consumer BAdI Interface - Technical Operations - SCN Wiki
Regards,
Raghavendra
Great How-to - thanks for sharing!
** Great Howto thanks for sharing!
Hi Deepak,
Very nicely prepared document; clear to understand, and easy to implement.
Having not much coding skills, I have a naive question: how can I use this BADI to update/change contents of the email (E_EMAIL_TEXT)?
Or else, are there any other options to change the email content?
Reason being, we currently use old CCMS technology to automatically create incidents in a third party tool.
Via tcode ALRTCATDEF --> CCMS ALERTS, the email contents in CCMS has following template:
field: <parameter>
eg:
Alert Text: &MSG&
Alert Color: &ALERTVALUE& (1 = green, 2 = yellow, 3 = red)
I would like to adapt to a similar email content structure from Solution Manager 7.1 (SP11) as well.
Is it possible? Highly appreciate any help.
Thanks in advance,
Shaji
Hi Deepak,
great document!
I activated flag 'Send notification for closed alerts' in Technical Monitoring > 2.3 Default Settings. I also get an additional notification whenever the alert get closed. But in subject the "Closed:" expression is missing. Does anyone know how to implement the "Closed:" functionality in a customized Email subject?
Update Jan 27, 2015:
In the meantime I was able to solve it...
e.g.
code:
method IF_ALERT_DYN_COFIGURATION~GET_NOTIF_CONF_FOR_ALERT.
DATA lv_mon TYPE string.
DATA lv_alert TYPE string.
DATA lv_status TYPE string.
DATA lv_rating TYPE string.
lv_alert = io_alert_object->if_alert_consm_object~get_name( ).
lv_mon = io_alert_object->if_alert_consm_object~get_managed_object_name( ).
IF io_alert_object->IF_ALERT_CONSM_OBJECT~GET_RATING( ) = '2'.
lv_rating = 'Yellow'.
ELSEIF io_alert_object->IF_ALERT_CONSM_OBJECT~GET_RATING( ) = '3'.
lv_rating = 'Red'.
ENDIF.
IF io_alert_object->if_alert_consm_object~get_status( ) = 'O'.
lv_status = 'Open'.
ELSEIF io_alert_object->if_alert_consm_object~get_status( ) = 'C'.
lv_status = 'Closed'.
ENDIF.
CONCATENATE lv_status `: ` lv_mon ` ` lv_alert ` (` lv_rating `)` INTO e_email_subject.
endmethod.
Best regards,
André
Hello Deepak Nemani ,
Nice Blog.
I have requirement here, there are two set of alerts for one of customer and Email subject has to be changed on only for one team.
What would be the identifier for carrying out this change ?
Thanks and Regards,
Nikhil Kulkarni
Hi Nikhil,
What are those two sets of alerts? Can you distinguish them at runtime in abap code? Then it is just a simple "if condition" in your BAdI implementation.
Check the official documentation on this and check the input alert object interface. See if you can use any of the object properties to your advantage.
Regards,
Raghavendra
Hello Raghavendra,
They are nothing but Technical Scenarios.
lv_tech_scenario = io_alert_object->if_alert_consm_object~get_technical_scenario( ).
Also, can you please suggest how can we test this alert triggering manually from Solman Alert inbox ? Is it possible ?
THanks and Regards,
Nikhil Kulkarni
Hi Nikhil,
You can then simply check for your tech scenario in if-else conditions and prepare your e-mail subject accordingly.
You can trigger alerts manually in Solman for testing purposes only and not to be used in production systems as data will get adulterated with simulation data.
I'll check if I'm allowed to share the link to that solman application here.
Regards,
Raghavendra
Hello all,
is there any chance to add a kind of "auto confirm" (e.g. after 30 minutes) or ar BADI (send email and confirm alert) which can be used? We are transfering alerts from technical monitoring via email to all recipients - those are not working with Alert Inbox.
Regards
Michael
Hello,
Can i know what is the difference between the BADI's BADI_DYN_INCI_NOTIF and BADI_DYN_INCI_NOTIF_MULTIPLE ?
Regards.