Skip to Content

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.
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.

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

  1. E.g Email

To report this post you need to login first.

23 Comments

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

    1. Ravindran Pather

      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

      (0) 
    1. Deepak Nemani Post author

      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

      (0) 
    2. Michael Blickenstorfer

      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

      (0) 
  1. Ravindran Pather

    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

    (0) 
    1. Deepak Nemani Post author

      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

      (0) 
  2. Ravindran Pather

    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

    (0) 
    1. Deepak Nemani Post author

      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

      (0) 
      1. Ravindran Pather

        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

        (0) 
  3. Shaji Narayanan

    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



    (0) 
  4. Andre Schäuble

    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.

    /wp-content/uploads/2015/01/alert_632498.png


    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é

    (0) 
  5. nikhil k

    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

    (0) 
    1. Raghavendra D

      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

      (0) 
      1. nikhil k

        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

        (0) 
        1. Raghavendra D

          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

          (0) 
  6. Michael Gebauer

    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

    (0) 

Leave a Reply