Interactive Script in Interaction Center SAP CRM
Step 1: Creating Script from IC Manager
Go to web UI -> business role -> IC_MANAGER – IC Manager -> Process Modelling-> Interactive Script Editor.
It takes sometime to load the page. It is build on Java Technology. There may be a need to install plugin and JRE 1.4. Also, browser security should be set to allow scripts to run this component.
Once after page has been loaded, Click on “New -> Script “ on the menu.
In “Script Properties” tab, give the Description and Script ID.
- Create Script Chapters:
- Create Questions:
- Add the Button to the Question:
Expand the Repository and expand “Answers” in the Repository. Standard Buttons exist, button can also be created using menu “ New -> Button ” and give the ID and Label to the button.
To add the Button, Button Area should be added to Question Screen. To do that, click on the “Add Button Area” on the top of the screen.
From the Repository, click and Drag the Buttons Example: “Yes”, “No” Buttons to the Button Area.
Similarly, Checkbox, Dropdown List Box, Text Fields can be added to the Area. They need “Answer Area”. It can be added using “Add Answer Area” button on the top of the Question Screen.
- Creating Branching and Non-Branching Actions:
Actions can be created using “New -> Action “ from the menu located at top of the screen.In “Action Properties” tab in the bottom of the screen, give the Action ID. Select radio button to make action “Branching” or “Non-Branching”.
Create the input, output parameters and also branching conditions. These parameters are handled in the class specified for the action Example: “ZCL_CRM_IC_SCRIPT_ACTION_01”.Create this Z Class to implement the action by copying any standard action class Example: “CL_CRM_IC_SCRIPT_ACT_BRANCH2”.
This Z class shoould contain implemention of method from Interface:
<IF_CRM_IC_SCRIPT_PRO2>~ SET_PROCESSOR( )
<IF_CRM_IC_SCRIPT_ACTION>~ EXECUTE( )
See the Standard for Set_processor( ). In Execute( ) method, write the logic for manipulating input and output parametres (IN_PARAMS, OUT_PARAMS) and Branching code (BCODE).Example:
METHOD if_crm_ic_script_action~execute .
DATA : lv_dc TYPE REF TO if_crm_ui_data_context,
lv_bpartner TYPE bapibus1006_head-bpartner,
ls_address TYPE bapibus1006_address,
lt_return TYPE TABLE OF bapiret2,
ls_out_params LIKE LINE OF out_params.
” Get the data context
lv_dc = cl_crm_ui_data_context_srv=>get_instance( ).
CHECK lv_dc IS BOUND.
” Get current customer/contact
lv_dc->get_entity_attribute_as_value( EXPORTING path = ‘//currentCustomer/BP_NUMBER’
IMPORTING value = lv_bpartner ).
CATCH cx_root. ENDTRY.
” Get address details of business partner
CALL FUNCTION ‘BAPI_BUPA_ADDRESS_GETDETAIL’
EXPORTING businesspartner = lv_bpartner
IMPORTING addressdata = ls_address
TABLES return = lt_return.
” Check for any errors, in case of error branch to “CONDTION_02” ” OR else fill the details for output parameters and branch to “CONDITION_01”
READ TABLE lt_return WITH KEY type = ‘E’ TRANSPORTING NO FIELDS.
IF sy-subrc = 0.
bcode = ‘CONDITION_02’.
bcode = ‘CONDITION_01’.
ls_out_params-key_p = ‘BP_ID’. ls_out_params-value_p = lv_bpartner. APPEND ls_out_params TO out_params.
ls_out_params-key_p = ‘CITY’. ls_out_params-value_p = ls_address-city. APPEND ls_out_params TO out_params.
ls_out_params-key_p = ‘PINCODE’. ls_out_params-value_p = ls_address-postl_cod1. APPEND ls_out_params TO out_params.
Based on the BCODE branching can be done similar to if-else statement.Output Parameters can be used to detail upcoming flow in the script.
- Using Output Parameters in the Question:
Expand the Repository, expand Actions and Branching. The Action created for Branching can be seen. Expanding the Action reveals Output Parameters. Create a Question, Drag and drop the Output parameters of the Action to the Question Description Area. Example is shown in the screenshot.
- Create the Mapping in Script Screen:
Drag and Drop Question, Script, Actions required for the Script to run from the Repository to the Script Screen.
Link and flow between these objects in the script screen can be created by clicking on the “Link” Button on the Top of the Screen. Click an Object and Drag itto the next level flow object.If the Question has buttons or Action has Conditions, it will ask for the button/condition to be choosed. This specifies on the click of the button or on the condition of actionthe linked flow takes place.
Select a Question/Action/Script. Specify the Starting Node by checking a check box in “Node Properties” tab on the botton of the screen. This node is going to be the starting node of the flow.
Step 2: Creating Script Profile and configuring IC
Go to SPRO -> SAP Customizing Implementation Guide -> Customer Relationship Management -> Interaction Center WebClient -> Define Script Profiles
In “Script Profiles” Dialog Structure, Create New Entry,
Give the Details for Script Profile.
Add the Script created in IC Manager to this profile.
Add Language to the Profile.
Go to SPRO -> SAP Customizing Implementation Guide -> Customer Relationship Management -> Interaction Center WebClient -> Define Business Role -> ( Select on the Interaction Center Business Role needed Example: IC_AGENT ) and double-click “Assign Funtion Profiles” in Dialog Structure.
Find the Function Profile ID “Script” and assign the Script Profile to it. Save it.
In IC_MANAGER , select the script and select “Script Profile” tab in the bottom of the screen and add the Script Profile.
Script is ready to run.