In this blog, I'm going to discuss tips and tricks to consider when printing to PDF from the Web Application Designer
in SAP NetWeaver 2004s BI.
How it works?
The most important thing to consider, is which objects are supported when printing to PDF. This is listed in the online help here. Therefore, these are the only Web items you can print to PDF. When printing to PDF, you have 2 options:
1. Print all Web items in Web template. In this case, any supported Web item you choose will be printed in the order in which it appears in the Web application.
2. Bind printing to individual supported Web items. In this option, you can display lots of Web items on your Web application, but only print a few when exporting to PDF.
The most important thing to note is when printing to PDF, the entire Web application as displayed on the screen isn't printed to PDF. The Web items used are sent sequentially, in the order they appear in the Web application, to be printed in PDF. Therefore, the printing prints each Web items sequentially and doesn't retain layout of these Web items with respect to each other. Therefore, if two items are "side-by-side" on the Web application, they won't be printed that way. The first one will be printed to PDF and the second one will be sent after it and appear underneath in on the PDF. The only way to retain format is to use the "Report" Web item. This Web item will print the format as it appears.
Updating Headers and Footers
As shown in the link above from the online help, the headers and footers support date, time, page numbers, and free text. If you want to add other parameters to the header or footer, currently, as of SPS9, this is not available natively. Currently, there are plans in SPS11 to allow including an image in the header of Web applications via the print dialog as per the GA Limitations listed here.
To embed images in your Web application, you can use img tags to embed images within the body of the Web application. This cannot be included in the header when printing to PDF as listed in the limitation above. To do this currently, any image in the body will be printed when printing to PDF. To embed an image from the MIME repository, you can use the following code:
<img src="bwmimerep:///sap/bw/mime/ Customer/Images/SAP_LOGO.gif" border="0"/>
This image will be printed in the order in which it appears within the Web application. Again, this does not retain the layout positioning of where the image is located in the Web application. To print an image to PDF with regard to keeping layout, you must embed it in the report Web item and use this report item within your Web application.
Working with objects in the body
As mentioned in the online help, the export to PDF supports the Information Field Web item. You can use this to display filter values, variable values, or generic text elements. If you use this in your Web template, you can print out this information within your PDF export. If you want some of these properties to print at the top of your application, and some at the bottom, you will need to embed this twice and bind the individual parameters you want in each Web item.
The other option is to use the Text Web item. If you this at the top of the Web application, this information will show at the top of the PDF export. The difference with using these parameters at the top of the Web application and using the header is that the header repeats on each page whereas these parameters will only show on page one. Using this text Web item, you can hardcode any header parameter you need. To dynamically populate this with parameters such as the query name, filter values, variable values, or even results cells, you can use XPATH statements. See this blog on using XPATH statements.
The most important thing to note is that layout must be controlled within the report item. If you want to embed a formatted report and chart side by side, both must be embedded in the Report Item. Otherwise, these are serialized within the Web application and they will be printed vertically, not horizontally.
I've tested these scenarios on SPS9 with FEP902. Hope this helps you with your printing needs!
Prakash Darji is a member of the SAP NetWeaver Integration RIG with a focus on FrontEnd technologies.
This content is reposted from the SAP Developer Network.
Copyright 2006, SAP Developer Network
SAP Developer Network (SDN) is an active online community where ABAP, Java, .NET, and other cutting-edge technologies converge to form a resource and collaboration channel for SAP developers, consultants, integrators, and business analysts. SDN hosts a technical library, expert blogs, exclusive downloads and code samples, an extensive eLearning catalog, and active, moderated discussion forums. SDN membership is free.