Acorel
To Acorel.nl
Acorel background

Alert notification email with deeplink to a CRM object

Daniël Roest, 13 November 2013

As you probably already know you can use the action framework to send alerts to users when certain defined events occur. For example to notify the person responsible one week before the validity date of a quotation is reached, or when a new task is assigned to a user by someone else.

By default the user who receives the alert also receives a notification email. If, after reading it, he wants to take action, he needs to open his web browser, start SAP CRM, log in, search for the alert in the open alert list, open it and click on the link to navigate to the CRM object. Many steps are needed here and many users don’t see much added value from this notification email and turn it off via Worklist > Personalize Alerts.


But what if we can add a url link to the notification email so that the user can directly jump to the CRM object the alert is about and he only needs to enter his username and pass to login?

Let’s see how we can do this.


Step 1 – Customize action and alert

First, you do all the necessary customizing in the action profile and define an alert category to successfully send the alert. You have also maintained a long text as demonstrated in the example below.

Step 2 – Define url

Second, we go to the tab ‘Optional Subseq. Activities’. Here we define the url to deeplink to our CRM object. It consists of a part to start the CRM webUI followed by several startup parameters. I will not discuss these parameters in detail here. Please refer to our previous blog Deeplinking to SAP CRM Objects for more information.

Some of these parameter values are fixed, but others are dynamic. There are of course different SAP CRM environments to navigate to and each object is uniquely identified by a GUID. We fill these variables later, but for now we need to define placeholders for them. Make sure the placeholders are at least as long as the values that are filled later, otherwise we cloud lose some text fragments.

In our example we link to a task so therefore the value BT125_TASK for crm-object-type. We added placeholders for the CRM hostname, crm object value (GUID), sap client and language.

Step 3 – Implement BAdI

We now need to create an implementation for BAdI ALERT_MODIFY_TEXT. In this BAdI we can replace our placeholders with the real values. Go to SE19, create the BAdI implementation and use the code below as a starting point for your own implementation. Don’t forget to add the alert class and category as filter value.

METHOD if_ex_alert_modify_text~modify_long_text.
  DATA: lv_str TYPE string.
  CONCATENATE ‘http://’ sy-host ‘.company.com:8000’ INTO lv_str.
  REPLACE ALL OCCURRENCES OF ‘http://XXXXXXXXX.company.com:8000’ IN TABLE ct_long_text WITH lv_str.

  CONCATENATE ‘crm-object-value=’ ip_appl_guid INTO lv_str.
  REPLACE ALL OCCURRENCES OF ‘crm-object-value=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX’ IN TABLE ct_long_text WITH lv_str.

  IF ip_langu = ‘E’.
    lv_str = ‘sap-language=en’.
  ELSE.
    lv_str = ‘sap-language=nl’.
  ENDIF.
  REPLACE ALL OCCURRENCES OF ‘sap-language=XX’ IN TABLE ct_long_text WITH lv_str.

  CONCATENATE ‘sap-client=’ sy-mandt INTO lv_str.
  REPLACE ALL OCCURRENCES OF ‘sap-client=XXX’ IN TABLE ct_long_text WITH lv_str.

ENDMETHOD.

End result

Let’s check the end result. The email notification now contains the url that deeplinks to the task the alert refers to.


Daniël Roest

Read all my blogs

Receive our weekly blog by email?
Subscribe here: