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 alertFirst, 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 urlSecond, 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.
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.
Step 3 – Implement BAdI
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'.
lv_str = 'sap-language=nl'.
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.