Technology Blogs by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
cancel
Showing results for 
Search instead for 
Did you mean: 
Former Member

One of the requirements I had when tasked in developing  a dynamic webdynpro graph display page was to have a print preview function that’s triggered upon the click of a button. As my webdynpro is not in a browser setting but shelled in a SAP GUI, the user can’t use the print preview function available in the IE browser.  At the time of this writing, SAP provides a print functionality for printing as detailed here . However this does not meet my requirement as firstly it’s a direct print function, not a print preview function. And secondly, the client is running on SAP Netweaver 7.0 EHP1, as oppose to EHP2 and above which supports this functionality. As ABAP webdynpro does not support javascripting, I did a workaround by calling a BSP page (with the webdynpro display encapsulated in an iframe) and triggering a countdown timer (this creates a time buffer to allow the page to render the graphics) before the print preview popup is displayed. Steps detailing this workaround are as below: 

  • Create a new BSP Application and insert the code as below in the event handler tab. Here, we’ll create a url construct of our targeted webdynpro application and assign it an attribute.

  • In the layout tab, insert the code as below. As you can see, I’ve set a timeout of 2 seconds before the function PrintMe() is called. Function PrintMe() contains the code for print preview and closes the window after the user clicks print and the focus returns to the parent window.  The Iframe houses our attribute, which was assigned the constructed url of our webdynpro application earlier.

        Edit : If you want a direct print function instead of a print preview one, change the var OLECMDID to 6 instead.

  • In the webdynpro  view insert a print link/button and create a corresponding event method (I’ve named my method as print).

  • In the method, construct the BSP url and do a call to the BSP Application we’ve created earlier.

  • Execute the application. In my example, my webdynpro application is called from a custom program and is housed in the SAP GUI.

  • Click on the print icon and the print preview function should trigger.

3 Comments
Labels in this area