Wednesday, March 14, 2012

Real Time Offer Management (RTOM) SAP CRM Customizing

In last weeks blog, we discussed the technical setup needed for RTOM. This included the steps needed for setting up the communication between the SAP CRM server and the RTOM server.
This week, we will show what customizing is needed in SAP CRM to enable Real Time Offer Management in a business role.

Function Profile
To activate RTOM in a business role we need to assign a function profile of the type OFFER. To create this profile use transaction CRMC_IC_RE_PROF, which does not exist in SPRO.

Set port to ‘RTOM’ (as created in the publish proxy).
You then can assign the function profile ‘OFFER’ to business role of your choice.

Navigation profile 
To add the products from the RTOM offer to a CRM document you add them to a cart in the offer screen and then use the button ‘Add from cart’ in a CRM document. In CRM 7.0 this button is not available. This is due to the fact that SAP CRM is not using the specific IC screen any more.

So, we can either start using the old screens, or we can enhance the UI to incorporate the button in the new screens. My advice would be to enhance the UI and copy the code from the old screens. Both options will be listed below.

Option 1: Revert back to the old IC screens.
We have to use the ‘old’ IC-screens, IC_BT_SLSO not the UIU screens. In the nav. profile, this OP-mapping shows how the new UIU screen is called. Change the targets into IC_SLO like this, for all lines having object type BT115_SLSO

Result is available in the IC-sales order workcenter. Note that the button is only shown when there are offers in the cart.

Option 2: Copy button to new UIU screens
To copy the button and its logic to for instance the service order UI component.

Source UI component: ICCMP_BT_SLO, view Slo1Cart
Target UI component: BT116QIT_SRVQ, view SCItemTree

In this target view, we add a button to the toolbar on top of the items. The button will be shown when there are items in the cart, and when hit, it adds the items to the quotation. To add this button and logic, enhance the UI-component.

In the Prepare Toolbar method add; (Copied from ICCMP_BT_SLO, view Slo1Cart, method SET_TABLE_BUTTONS)

* check if there are products in the basket if so, and no order existed at that time, this button is displayed when navigating to the order 

gv_prod_in_cart = abap_false. 

   lr_cucoproduct ?= me->get_custom_controller( controller_id = if_iccmp_global_controller_con=>cucoproduct ). 

CATCH cx_root. 

IF lr_cucoproduct IS BOUND.
   gv_prod_in_cart = lr_cucoproduct->is_cart_available( ). 

* Button AddFromCart 
IF gv_prod_in_cart EQ abap_true. 
   CLEAR ls_button. 
   ls_button-type = cl_thtmlb_util=>gc_separator. 
   APPEND ls_button TO rt_button. 
   CLEAR ls_button. 
    ls_button-id = 'AddFromCart'. "#EC NOTEXT 
    ls_button-text = cl_bsp_runtime=>if_bsp_runtime~get_otr_text( 'CRM_IC_APPL/ADDFROMCART' ). 
    ls_button-on_click = 'AddFromCart'. "#EC NOTEXT 
    ls_button-enabled = lv_changeable. 
   APPEND ls_button TO rt_button. 

Add method EH_ONADDFROMCART (complete copy of ICCMP_BT_SLO, view Slo1Cart, method EH_ONADDFROMCART.

* Added by wizard: Handler for event 'ADDFROMCART' 

DATA: lr_cucobt TYPE REF TO cl_iccmp_cucobt_impl, 
           lr_cucoproduct TYPE REF TO cl_iccmp_pr_cucoproduct_impl. 

  lr_cucobt ?= me->get_custom_controller( controller_id = if_iccmp_global_controller_con=>cucobt ).
  lr_cucobt->transfer_to_order( ). 
CATCH cx_root. 

* When the products inside buffer is updated to order,nothing should inside the buffer.

lr_cucoproduct ?= me->get_custom_controller( controller_id = if_iccmp_global_controller_con=>cucoproduct ).
lr_cucoproduct->typed_context->addtocartbuffer->collection_wrapper->clear( ). 
CLEAR gv_prod_in_cart.

Intent Driven Interaction 
CRM uses the Intent Driven Interaction (IDI) functionality to integrate the RTOM functionality into the standard processes. We need to define a new service in SPRO:
CRM > WebClient > Additional functions > IDI > Service Manager > Define services

We also need to define a new action in the ICRULE repository. This can be done in SPRO as well:
CRM > WebClient > Additional functions > IDI > Define repository:
CRM > WebClient > Additional functions > IDI > Define events in repository: 

The following events are suggested triggering events.
  • BPConfirmed - Business Partner Confirmed
  • BTCreated - Business Transaction Created
  • BDCCurrentOneOrderchanged - Order Changed 
  • Categorychanged - Category Changed 
  • Ordersaved - Order Saved
  • Ibase Confirmed
  • IObject Confirment
  • QuotationRejected - Quotation was rejected
  • OfferlistCreateQuotation - Create quoatton from offerlist
  • OfferListDontOffer - Offer was not offered from offer list
  • QuotationSummary - Quotation move to summary

Now we need to configure IDI events. This can be done in the businessrole IC_MANAGER.
In menu item Process Modeling, choose Rule Policies and create the following policies.

On the events mentioned, we want to trigger different actions, depending of course on the event and the context. How to work the rule builder can be found in this blog. Keep in mind that you have to release all your rules before they become active. Also note that rules are applied per system and are not transportable. Also, releasing a rule activates it immediately.

We used the following actions:
  • RTD Engine Event: Start Session
  • RTD Engine Event: Business Trans Created
  • RTD Engine Event: Data entered in BT
  • RTD Engine Event: Ibase Confirmed
  • RTD Engine Event: Object Confirmed
Create RTOM Campaign type
Offers for RTOM are created in CRM as Campaigns of the type RTOM Offer. We need to create our own campaign type in customizing
CRM > SPRO > Marketing > Marketing Planning and Campaign Management > Basic Data > Define Types/Objectives/Tactics 
The system is now prepared to work with RTOM. You will still need to implement the rules in the RTOM engine to actually get results of course.