Browser print implementation of CRM WebClient UI

Source: Internet
Author: User

WebClient a Print button on the UI, press CTRL + P to generate a new page for printing.


As shown in. You can see that all the hyperlinks in this page have been removed.

The generated logic for this page is as follows.

1. Pressing CTRL + P will trigger the WebClient UI frame's key response function Thtmlbkeydown. In the browser's incoming event handler, the CTRL attribute is True,keycode 80 (key p corresponds to code), which means CTRL and P are pressed simultaneously.

This response function Thtmlbkeydown is registered to the entire Document object, so you can get a response if you click Ctrl+p anywhere on the page.

From the upper right-hand corner of the call stack can be found Crmfrwprint is called. The Crmfrwprint will open the Print.do controller, located in the BSP application Bspwd_basics.

2. Open the implementation class for the Print.do controller Cl_bspwd_basics_print

This controller will open the print.html page

3. The content of the page generated after we press Ctrl+p is generated in print.html. In the function ppstartscripts, the core code is registered to the Load event of the page by thtmlbregisteronload, meaning that it executes when the print.html is loaded.


Thtmlutil.addeventhandler is the event registration function that is packaged by SAP itself and is used for compatible support with multiple browsers.

The core of the two functions:

Createshield

Create a div with a height and width of 100%, and set the background image to the SAP pre-defined 1x1.gif.

The runtime is displayed as follows:

LoadPage

The original page with the Ctrl+p key has been window.opener, and the HTML of all the elements below it th-l-wcsubheadercontainer copied directly below the header element of the PrintOut page.

This enables the content of the original page to be moved to the PrintOut page.

Then get all the hyperlink labels for the printed page, and then place the href and onclick of the tags into a function with a function body of return false, so that the hyperlinks are no longer clickable.

var?nirvana?=?new?Function?(?"return?false;"?);

To get more original Jerry's technical articles, please follow the public number "Wang Zixi" or scan the QR code below:

Browser print implementation of CRM WebClient UI

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.