When we display a transaction in CRM WebUI, there is a CRM 'Print Page' function. For example, open an interaction record detail screen from webui, click the print icon(or Ctrl+P):
a new window will be opened with the printed information:
When the 'Print Page' icon is clicked, JavaScript codes in BSP Application BSPWD_BASICS->print.htm is executed. For some requirement, I recently enhanced the print.htm page. Due to the specific position in framework, it is not possible to enhance view BSPWD_BASICS/print simply as we do for other components and views. In this article, I will note down how I enhanced it and make system call the enhanced print.htm page. It is an Ehp3 system where I made the test.
System Logics:
- Print.do under BSPWD_BASICS is specified in WorkAreaHostContent.htm file under BSPWD_BASICS->Page Fragments->WorkAreaHostContent.htm.
- WorkAreaHostContent.htm is specified in BSPWD_BASICS/WorkAreaHostViewSet.htm.
- BSPWD_BASICS/WorkAreaHostViewSet is embedded in CRM_UI_FRAME.
Steps for enhancement:
- Execute BSP_WD_CMPWB, enhance BSPWD_BASICS. I named enhanced bsp application ZBWD_BASICSGW.
- Enhance 'Print' view.
- Even though it shows error, just click 'Ok' button to ignore it.
- It will also show information 'View BSPWD_BASICS/print is not defined in the runtime repository that was loaded'.
- But the enhanced print view is now under my bsp application ZBWD_BASICSGW.
- Now enhance BSPWD_CMPWB/WorkAreaHostViewSet.
- Name controller class ZLBSPWD_BASICS_WA_HOSTVS when required.
- Give name to context attribute type ZLBSPWD_CONTEXT.
- Don't forget to change method and active it.
- Now copy WorkAreaHostContent.htm.
- Input the bsp application name you created just now. Please notice, give a new page name.
- This ZWorkAreaHostContent.htm will appear under ZBWD_BASICSGW. Edit this file, change the codes as highlighted: BSPWD_BASICS is replaced by your own new Z bsp application. Here it is ZBWD_BASICSGW. After the change, save and active.
- In order to bring the ZWorkAreaHostContent.htm in, now we should edit the enhanced BSPWD_BASICS/WorkAreaHostViewSet.htm file. Double click on WorkAreaHostViewSet.htm.
- Change, save and active.
- In order to make the framework call the above enhanced views, we need to enhance CRM_UI_FRAME also.
- There is no 'Enhance' function for BSPWD_BASICS/WorkAreaHostViewSet under CRM_UI_FRAME. We need to use another way to bring the enhanced view in. Please see the next step.
- Execute T-code SM34, maintain view BSPWDVC_CMP_EXT. Select CRM_UI_FRAME for enhancement set ZENH_GW_NEW, double click 'Controller Substitutes'.
- Add an entry manually.
- Now we come back to CRM_UI_FRAME, the enhanced view is visible.
- Now set breakpoint in print.htm file under ZBWD_BASICSGW.
- Open CRM webui, display a transaction, click 'Print'.
- We can see the print.htm file under customer bsp application ZBWD_BASICSGW is executed. Now we can add our own codes in the print.htm file: