Here is a step-by-step example for enabling alert notification for Account changes.
1. Define Connection to Central Alert Server
In transaction SPRO go to path Customer Relationship Management->Basic Functions->Alert
Management->Define Connection to Central Alert Server.
Use search help to select the RFC destination for the system (and client) in which your Central Alert Management is running. The alerts are forwarded from this system by RFC to the central alert server, from where they are delivered centrally. Alert categories must be defined on the central alert server.
If this system is the central system, on which all alert categories are defined, and from which the alerts are delivered, enter NONE as the RFC destination.
2. Define alert classifications
This step is optional. These are useful to group alert categories.
3. Define alert categories
The category contains various properties and other specifications that define the alerts within that category, for example expiry date, or the escalation recipient. For example, you can create the alert categories Contract Cancelled and Decrease in Sales. When the critical situation defined in the alert category arises, the system recognizes this and sends an alert instance of this category to the recipients determined. The alerts can always be found in the display programs configured for the recipient (UWL, application-specific program, or alert inbox). Additionally, the alerts are sent via eventual external communication channels, such as e-mail, sms, or fax.
On the Container tab page, define any variables that you may want to use in the short text or long text.
On the Long and Short Text tab page, enter texts for the alert category.
You can include text variables referring to elements of the alert container or system symbols.
4. Determine recipients
5. Triggering alerts
Alerts of a particular category must be triggered by an application at runtime. Triggering alerts can be done in various ways. You can call a function module
directly or use middleware components that trigger alerts, such as the Business Object Repository (BOR), Post Processing Framework (PPF), SAP Workflow, or CCMS.
In this example the alert is triggered by function module call in the Save event handler of the UI component view. This is done in transaction BSP_WD_CMPWB – UI Component Workbench.
CALL METHOD super->eh_onsave
htmlb_event = htmlb_event
htmlb_event_ex = htmlb_event_ex
ev_success = ev_success.
DATA: lr_builheader TYPE REF TO cl_crm_bol_entity,
l_t_swcont_alert TYPE TABLE OF swcont,
l_s_swcont TYPE swcont,
lv_bpnumber TYPE bu_partner.
lr_builheader ?= me->typed_context->builheader->collection_wrapper->get_current( ).
check lr_builheader is bound.
lr_builheader->get_property_as_value( EXPORTING iv_attr_name = ‘BP_NUMBER’
IMPORTING ev_result = lv_bpnumber ).
l_s_swcont–element = ‘BP_NUMBER’.
l_s_swcont–value = lv_bpnumber.
APPEND l_s_swcont TO l_t_swcont_alert.
IF l_t_swcont_alert IS NOT INITIAL.
* build container via macros
CALL FUNCTION ‘RSRAS_BUILD_CAM_CONTAINER’
c_t_swcont = l_t_swcont_alert.
*** trigger SAP alert
CALL FUNCTION ‘SALRT_CREATE_API’
ip_category = ‘ZBP_CHANGE’
ip_wait_on_commit = ‘ ‘
* it_activities = l_t_activity
it_container = l_t_swcont_alert
alert_category_unknown = 1
alert_no_recipients = 2
alert_error_unknown = 3
destination_undefined = 4
communication_failure = 5
system_failure = 6
OTHERS = 7.
After Save button is pushed on the Account overview page, the alert is sent to the specified recipients.
More info about Alert can be found on the page below.