- 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.