Find out how to create custom events to trigger alerts to specific interaction center agents dealing with special customer issues, such as ordering hazardous materials. When you complete the process, you create a hyperlinked alert that takes the agent to documents to send to the customer.
Key Concept
SAP CRM contains standard events, which are activities in the system that trigger the system to behave a certain way. For example, the standard event InteractionEnded could occur when you complete a phone call with a business partner. This event triggers an alert to an agent to perform a certain task, such as to send information to the business partner.
Every customer interaction provides an opportunity to sell, so you should provide your interaction center agents with the insight they need to cross-sell and up-sell to a customer. A timely alert may help the agents by providing information they need to turn a service call into a sales opportunity. Creating an alert for a standard event is a challenging task that requires both configuration and programming. No documentation exists for creating custom events when a standard event isn’t delivered at a specific Interaction Center (IC) WebClient interaction point, so I’ll explain how to create the custom event that you need before you can develop a custom alert.
Imagine that some of the materials that your company sells are chemicals, which are classified as hazardous materials. As a policy, your company does not ship them via air, so it might take a long time for them to arrive. Also, customers who order these chemicals must sign a legal document the first time they order them. In this case, you could set an alert for the interaction center agents to let customers know about the shipping information. The alert could also let the agent navigate to a content server, pick up the legal document, and then email it to the customer, all within IC WebClient.
The events that trigger the display of alerts are limited to those that the SAP system defines, such as BPConfirmed or InteractionEnded. More often than not, CRM implementation teams run into requirements for alerts for which no standard event exists. In this case, you need to create a custom event to trigger an alert.
I’ll walk you through the process of creating a custom event and alert when a customer, using the telesales channel, adds hazardous material PH-2810 to the ERP sales order in IC WebClient. For this example, I used SAP ERP Central Component (ECC) 6.0 and SAP CRM 2005, although the process also applies to earlier versions. Make sure that you have the necessary authorizations for remote debugging of the Business Server Page (BSP) applications.
Prerequisites
Before you can create the custom event, you must perform five steps. The CRM technical team usually performs steps 1 through 3 and the CRM functional team typically performs steps 4 and 5. I’ll go over steps 1-4 briefly, as documentation exists for these steps. Refer to the IC WebClient cookbook mentioned in the “Additional Resources” sidebar to find out more details about steps 1-4.
Step 1. Create a new BSP application. This application contains the custom views and the corresponding controllers. I used the custom BSP application ZCRM_IC with transaction code SE80.
Step 2. Copy the standard views from CRM_IC to the custom BSP application ZCRM_IC. Use the IC WebClient Workbench transaction BSP_WD_WORKBENCH to copy the views. In my example, you copy the view ERPCart to the ZCRM_IC application.
Step 3. Implement a custom controller for the view using the original controller as the super class. In my example, ERPCart uses custom controller ZL_CRM_IC_ERPCART_IMPL, which is a sub class of CL_CRM_IC_ERPCART_IMPL.
Step 4. Set up the test user. In this step you configure and assign IC WebClient profiles to the test user.
Step 5. Check if a standard event exists that the system triggers when a telesales agent adds a product to the ERP cart. This step is a little complex, so I’ll explain it in detail in the following section.
Check If a Standard Event Exists
Before you create a custom event, make sure that a standard event doesn’t exist already. The standard class CL_CRM_IC_EVENT_SRV triggers events for IC WebClient for all the standard events. I’ll use this class to determine if the system triggers a standard event when the agent enters a material in the ERP sales order. This process involves three steps.
Step 1. Set an external breakpoint. Do this in the method RAISE of class CL_CRM_IC_EVENT after the call to the get_name method of the event. This breakpoint should break whenever IC WebClient triggers an event (Figure 1). Then start IC WebClient.

Figure 1
Breakpoint in the standard class
Step 2. Follow the inbound telesales scenario and confirm the business partner. To do this, simulate an inbound telephone call by using the contact center simulation (CCS) tool at https://:/ccsui. Or, you can enter the partner details (e.g., first name, last name, phone) in the Identify partner area of the IC WebClient application and click on the Search Account button. If you find multiple partners, choose one of the partners and click on the Confirm button to confirm the partner.
At this point, the system confirms the caller’s identity. All the subsequent functions the agent performs use this business partner until the agent clicks on the End button to end the interaction. After you confirm the business partner, the system triggers the standard event BPConfirmed, which stops at the breakpoint you set in step 1 of this process (Figure 2).

Figure 2
Breakpoint reached for a standard event BPConfirmed
Step 3. Enter the product in the sales order and press Enter. In this example, I entered the product PH-2810
on the order items area and a quantity of 1 bottle (Figure 3). If the breakpoint set in step 1 is hit again, it means that a standard event exists, so you do not need to develop a custom event. If this is the case, note the name of the event and use that event to create your alert.

Figure 3
The agent enters product PH-2810 on the ERP sales order
However, in my example, because no standard event exists, the execution doesn’t stop and the screen simply refreshes. In this case, the system doesn’t provide a place to add code to check for conditions (e.g., if the material entered is a hazardous material) and raise an alert for the agent. So now I must create a new event.
Create a New Event
The following six steps show you how to create a custom event that you can use to trigger an alert.
Step 1. Define a new alert in the IMG called ZRestrictedProducts. Use transaction SPRO and follow IMG menu path Customer Relationship Management>Interaction Center WebClient>Basic Functions>Define Alerts and Alert Profiles. Click on the New Entries button and enter the Alert ID ZRestrictedProducts
(Figure 4).

Figure 4
Enter the Alert ID
You can use the standard SAP class CL_CRM_IC_ALERT_GENERIC for generic alerts. The system displays the message field as the alert text. Then, click on Events in the Dialog Structure to create triggering and terminating events. In my example, I used the alert ID as the triggering event and an End suffix for the terminating event (Figure 5).

Figure 5
Create triggering and terminating events
To provide the agent with additional information about the alert, you can use placeholders that are filled at runtime with variable data. In my example, the placeholder might be the product ID that triggers the alert. This lets the agent know exactly which product triggered the alert if the cart contained more than one material. Click on Placeholders to define them (Figure 6).

Figure 6
Define placeholders
When you’re finished, assign the alert to your alert profile by clicking on Assign Alerts to Profile. Then activate the alert by selecting the Active check box (Figure 7).

Figure 7
Select the Active check box
Step 2. Define the controller substitutes. The standard implementation calls the default views and their controllers, so you need to change the IC WebClient configuration so that the system substitutes your custom views and controllers for the profile. This is a standard process that allows you to replace certain standard IC WebClient views with customized views based on the runtime profile assigned to the agent. For more details about this process refer to the IC WebClient cookbook.
Use the IC WebClient Workbench transaction BSP_WD_WORKBENCH to copy the ERPCart view from the CRM_IC BSP application to the ZCRM_IC BSP application under the same name. Then use transaction SPRO and follow IMG menu path Customer Relationship Management>Interaction Center WebClient>Customer Specific System Modification>Define IC WebClient Runtime Profiles (Figure 8). Select your runtime profile and click on Controller Substitutes. Click on the New Entries button to create a controller substitute. Substitute controller CRM_IC ERPCart with ZCRM_IC ERPCart.

Figure 8
Define controller substitutes
Step 3. Identify the server event that the system triggers when the agent enters the product in the ERP order. This allows you to make your changes in your custom controller class so the system triggers the alert only for certain agents who are assigned to a specific interaction center. Agents assigned to the other run time profiles are not affected.
The server event is the handler for the user action on the IC WebClient screen. Set a breakpoint in the DO_HANDLE_EVENT method of the custom controller ZL_CRM_IC_ERPCART_IMPL. From the IC WebClient workbench (BSP_WD_WORKBENCH), enter your custom BSP application (ZCRM_IC) and click on the execute icon. Expand the Views and double-click on ERPCart to get to the details. Create a new class ZL_CRM_IC_ERPCART_IMPL as a subclass of the standard SAP controller CL_CRM_IC_ERPCART_IMPL. Double-click on ERPCart.do to change the implementation class to ZL_CRM_IC_ERPCART_IMPL (Figure 9).

Figure 9
The ERP Cart view custom controller
Override the DO_HANDLE_EVENT method of the parent class and add a call to the parent method. Put a breakpoint at do_handle_event
and restart IC WebClient (Figure 10). Repeat the process of confirming the business partner and entering the product on the ERPCart as described in the “Check If a Standard Event Exists” section.

Figure 10
Set a breakpoint at DO_HANDLE_EVENT
The breakpoint is hit for standard events as well as custom events, so the execution stops when standard events are hit. For example, the execution stops when the business partner is confirmed. Ignore the breakpoint until you enter the material on the order and press Enter.
When the breakpoint is reached, the ABAP debugger starts automatically in a new SAPGUI window with a yellow arrow pointing to the current execution line. Press the continue key (F8) to ignore all the breakpoints before the ERP sales order is displayed. When the ERP cart is displayed in the IC WebClient application work area, enter the material and quantity on the cart and press Enter. When the execution stops again in the debugger, note the name of the server event that the system processes when the telesales agent enters a material on the order. In this case, the name of the server event is check, which you can see in the Val. column of Figure 11. I’ll use this server event to raise my application event in the next step.

Figure 11
Execution stops at breakpoint
Step 4. Raise a custom event when the user presses Enter. Add the code in Figure 12 after the super->do_handle_event
call. By raising the event, the custom event OrderChecked is triggered whenever the system checks a material entered on the order, similar to the standard event BPConfirmed that the system triggers when you confirm a business partner.

Figure 12
Code to enter after the super->do_handle_event call
Step 5. Implement the method raise_event_check in the same custom controller class for the view (ZL_CRM_IC_ERPCART_IMPL). Add a public, constant string attribute GC_ORDERCHECKED to the class ZL_ CRM_IC_ERPCART_IMPL with the value OrderChecked. This is to avoid hard-coding the string OrderChecked by declaring it as an attribute of the custom class. The public attribute lets you use the attribute outside the class; the constant attribute makes sure that this attribute cannot be changed by any class that uses it. The code in Figure 13 clears the previous alert and raises a new event called OrderChecked.

Figure 13
Code that clears the previous alert
Step 6. Perform the configuration steps for the alert as you would for a standard event. Refer to the CRM Best Practices document for IC WebClient that explains how to create an alert for a specific event. You can find this in the Creating Event section at https://help.sap.com/bp_crmv250/CRM_DE/BBLibrary/Documentation/C78_BB_ConfigGuide_EN_US.doc.
In step 1 in this section, you defined the ZRestrictedProduct alert with a navigational link attribute, so the system displays the alert as a hyperlink (Figure 14). Clicking on the alert takes the agent to the location of the Material Safety Data Sheet (MSDS) documents. The agent can then warn the customer of the shipping delay and attach the safety datasheet to an email to the customer.

Figure 14
Alert appears on the IC WebClient message area
Additional Resources
Here are two resources that provide additional details about the standard steps mentioned in this process.
- The Consultant’s Cookbook for IC WebClient: https://service.sap.com/crm-inst. Click on CRM Core and Standalone Components.
- The CRM Best Practices document for IC WebClient: https://help.sap.com. Follow menu path Best Practices>Cross-Industry packages>CRM>V2.50>Technical Information>Building Block Library>C78: CRM Interaction Center (WebClient) >Configuration guide.
Sri Gollapudi
Sri Gollapudi is a senior architect with Hitachi Consulting, specializing in CRM IC WebClient customization, CRM Internet Sales, CRM Middleware, and SAP Portals. He has more than 15 years of IT experience, including 10 years in SAP technologies.
You may contact the author at sgollapudi@hitachiconsulting.com.
If you have comments about this article or publication, or would like to submit an article idea, please contact the editor.