SAP provides the ability to create alerts (emails) through the Alert Framework. Other modules, like SAP Event Management, integrate with the Alert Framework in order to send notifications on exceptions uncovered in the process.
The text that is maintained in the Alert Category definition (tx: ALRTCATDEF) is either static or mapped in from the called system (e.g. SAP EM).
At times we need to have the ability to manipulate the resulting mapped text. To do this you can use BAdI ALERT_MODIFY_TEXT. Note that the BAdI requires filter values relating to your Alert Category Class. See values for my scenario below.
The method to implement is called MODIFY_LONG_TEXT
Scenario: We need to replace the uppercaps with Lowercaps for TORONTO…
DATA: lv_line TYPE soli.
*IP_LANGU TYPE SYLANGU Language
*IO_ALERT TYPE REF TO CL_ALERT Alert
*value( FLT_VAL ) TYPE SALRTSCLSC Parameter FLT_VAL of Method MODIFY_LONG_TEXT
*IP_LOGHANDLE TYPE BALLOGHNDL OPTIONAL Application Log: Log Handle
*IP_APPL_GUID TYPE GUID_32 Application GUID
*CT_LONG_TEXT TYPE SOLI_TAB OPTIONAL Long Text
*CP_TEXT_TYPE TYPE SO_OBJ_TP OPTIONAL Text Type
*FLT_VAL-CATEGORY = Alert ID . E.g. Z_BK_BOOK_CANCEL
LOOP AT ct_long_text INTO lv_line.
IF lv_line CS 'TORONTO'.
REPLACE 'TORONTO' IN lv_line WITH 'Toronto'.
MODIFY ct_long_text FROM lv_line INDEX sy-tabix.
And the result is: