UIF_CALLBACK is a service, as seen from its description in SICF – ‘Generic callback’, it is used to dispatch the requests into specific classes which are specified as value of parameter ‘crm_handler’. It’s handler class is: CL_CRM_WEB_UTILITY:
In this article, I will explain with some samples how this service runs.
But in this way, it is not convenient to debug when we have some java script problems. Thus user parameter BSP_DLC_DEBUG_PARAM is introduced(in SAP Note 1771865). When this user parameter is set to JS_ALL_FRAMES, things will be changed — all java script files under BSP Application THTMLB_SCRIPTS will not be merged and loaded into one file, they will be loaded separately and one by one.
From the trace, we can see the service uif_callback is being used, for example:
Here, value for parameter CRM_HANDLER is CL_THTMLB_SCRIPTS_MANAGER.
How is it done?
In method CL_THTMLB_CONTENT-> IF_BSP_ELEMENT~DO_AT_BEGINNING, parameter BSP_DLC_DEBUG_PARAM is checked. If it is not set, the JS script will be ‘thtmlb_scripts/scripts.js’. But if it is set to value JS_ALL_FRAMES, requests of ‘…webcuif/uif_callback/…’ will be formed instead:
Then how are these classes working?
Let’s set a breakpoint in methods CL_CRM_WEB_UTILITY-> IF_HTTP_EXTENSION~HANDLE_REQUEST and CL_THTMLB_SCRIPTS_MANAGER-> IF_CRM_WEB_CALLBACK~HANDLE_REQUEST and see what happens.
- When the request is sent to backend system, CL_CRM_WEB_UTILITY-> IF_HTTP_EXTENSION~HANDLE_REQUEST parses the request parameters and gets the handler class, here it is CL_THTMLB_SCRIPTS_MANAGER:
- Object is created and initialized:
- Application handler is called back:
- Inside the method CL_THTMLB_SCRIPTS_MANAGER->IF_CRM_WEB_CALLBACK~HANDLE_REQUEST, requests are processed, the .JS content is read and returned:
- From the httpwatch trace, we can see the JS content is returned:
As introduced in SAP Note 2181937 ( Recent Items Filtering ), ‘Recent Items’ have filter functions added. Now, for the initial load of recent Items, for the filter dropdown list, for the items retrieving on a specific filter, they are using UIF_CALLBACK.
Take initial load of recent items as an example:
- In crm_bsp_recobj/RecentObjects.htm, there are codes:
- ‘Fetch’ function is defined in THTMLB_SCRIPTS-> scripts_areaframe.js.
- In this function, the request is sent out:
value for parameter ajaxURL is: “/sap(bD1FTiZjPTUwNCZpPTEmZT1TVEF6TXpVME1WOWZYMTlmTkRkZk1Ua3dBRkJXckViRUh1V21sQlNIX1ZJM2JnJTNkJTNk)/webcuif/uif_callback?crm_handler=CL_CRM_BSP__RECENTOBJECT0_IMPL&crm_controller=C6_W23_V24&wcf_request=display&wcf-request-ticket=CDB907FAF99F328F1997F34FF2C21322”
- The same, if we set breakpoint in CL_CRM_BSP__RECENTOBJECT0_IMPL-> IF_CRM_WEB_CALLBACK~HANDLE_REQUEST, we will get the callstack:
The same thing happens when click the triangle icon for ddlb and select an item to filter:
There are many other usages via this service uif_callback. For example, CL_THTMLB_COLOR_UTIL, CL_CRM_UI_SESSION_MANAGER, CL_THTMLB_COLOR_UTIL, CL_THTMLB_SMART_VALUE_HELP, CL_THTMLBX_SILVERLIGHT_ISLAND, CL_THTMLBX_FLASH_ISLAND, etc.