I hope this would be the first of many blogs that I would write sharing my knowledge with the community. This blog will cater to the topic of global custom controller, it's usage and various other related aspects.
Working with interaction center developments, it is common to come across a piece of code which gets instance of global custom controller or to do a configuration that deals with inclusion of global custom controller in the runtime framework profile. This blog aims to provide some insights related to the working of global custom controllers.
In this blog below I would try to explain in brief about below points:
- What are different global custom controllers available
- How to call our own controller instead of standard Global Custom Controller?
- How does framework Identify that custom controller is of global scope?
- How is creation of global custom controller done by framework?
- When are custom controllers defined in the runtime framework profile loaded?
- Where are Global Custom Controllers used?
It is recommend that you read this blog by Gert Tackaert to understand various concepts related to Interaction Record:
1. What are the different global custom controllers available?
Most of global custom controllers are defined as attributes of interface: IF_ICCMP_GLOBAL_CONTROLLER_CON
There are a few global custom controllers which are part of base framework application CRM_UI_FRAME as shown below:
2. How to call our own controller instead of standard Global Custom Controller?
There is a configuration available in SPRO -> Customer Relationship Management -> UI Framework -> UI Framework Definition -> Maintain Runtime Framework Profile. This controls 2 things:
- Global custom controllers to be automatically loaded on system start
- Replacement of global custom controllers with your own controller
Please note that above stated points are only effective for global custom controllers.
Below is screenshot of the SPRO configuration path:
Below are the Global Custom Controllers that will be automatically loaded for DEFAULT_IC profile:
Due to the global nature and special handling of this custom controller, if we want to call our z-controller after enhancing component and custom controller with the enhancement set – we need to do replacement of the same in Runtime Framework profile as shown below:
This is because of the code in the controller class CL_BSP_WD_CONTROLLER, method GET_CUSTOM_CONTROLLER, which reads the replacement as shown below:
Above code is triggered when we read a custom controller, sample code is as shown below:
Please note that if you are creating a new Z-version of the runtime framework profile, it has to be assigned to all the business roles for it to become effective in ‘Assign Function Profiles’ with ‘Function Profile Id’ as RUNTIME, sample is as shown in screenshot below for business role UTIC_IC:
3. How does framework Identify that custom controller is of global scope?
Below line of code in the GET_CUSTOM_CONTROLLER method of class CL_BSP_WD_CONTROLLER determines the scope by determining the prefix GLOBAL in front of the custom controller name.
4. How is creation of global custom controller done by framework?
Creation of controller is done by passing flag lv_global_scope as in the below code:
5. When are custom controllers defined in the runtime framework profile loaded?
Some controllers are preloaded depending upon the runtime profile configuration – this is done in:
6. Where are Global Custom Controllers used?
In interaction center scenarios where interaction record remains in context along with the BP and other confirmed context entities (such as business agreement, business transaction) depending on different scenarios – it is required to listen to and delegate events from one controller to another.
Let’s take an example – when we login to UI then controllers that are defined in the runtime framework profile are preloaded. Also, context initialization of all the components that are loaded is done through DO_INIT_CONTEXT method if IMPL class, to take an example, let’s say we are in DO_INIT_CONTEXT of component IUICMD which contains global custom controller IUICMD/CuCoMD – here it reads global custom controllers 'GLOBAL.CRMCMP_BPIDENT/CuCoBuPa' and 'GLOBAL.ICCMP_BT_GLOBAL/CuCoIRec' as shown in below screenshot:
Global Custom Controller CuCoBuPa is required to delegate code related to processes such as confirming BP, contact person or to handle events from within CuCoMD custom controller class by writing code such as shown below which triggers when ‘InteractionStarted’ event is handled in Global Custom Controller CuCoMDcontroller class CL_IUICMD_CUCOMD_IMPL in the method ON_INTERACTION_STARTED. This is how it interacts between different global custom controllers.
In the subsequent blogs I will touch upon global data context and clipboard in Interaction Center scenarios.