SAP BusinessObjects Enterprise BI 4.0

In this current series of SAP BusinessObjects Enterprise BI 4.0 – What’s New with the SDKs?, I’m describing new SDK functionality that I find particularly interesting in the recently released SAP BusinessObjects Enterprise BI 4.0 product.  In this brief blog entry, I’ll describe how you can modify the export format list as presented by the Crystal Report Viewer.

Crystal Report Viewer Export List

Create a bit of code to bring up a Crystal Report in the Crystal Report Web Viewer, then click on the export button.  In the export dialog box that appears, select the export format drop-down, and what you see is the following:

 

That’s one of the features of the viewer – it supports a lot of export formats.

But there’s times where you can’t or don’t want to give your clients so many choices.  For example, security and document assurance policies at an organization may explicitly prevent people from accessing the Crystal Reports (RPT) format, to eliminate any possibility of document modification.

Or for more casual users, you may want to restrict them to only PDF and Excel exports.

In previous versions of the viewer, there wasn’t a fully supported way of trimming specific export formats from the drop-down.  You could eliminate the export functionality altogether – which is typically not what clients want – but within strict supported deployments, you had to accept all the export formats, or none.

Modification of the export format list, when you really needed to do it, was something that had to be done outside of supported use.  There’s been a few ways – in XI Release 2 and previous, it was quite popular to edit the export.js JavaScript file included in the viewer to achieve this end.  However, one had to migrate these changes every time you applied a patch, and there was no guarantee that the same changes would work, since the export.js may have been modified by us.

Then with XI 3.0, it no longer was possible to modify the export format list via the export.js – changes in the internal code essentially made the list not accessible via static files.  The workaround then implemented by a few involved HTTP filters – to capture and modify the outgoing HTML stream at the web app server to eliminate the unwanted exports. This was, as you can imagine, much harder to maintain.

Removing an Export Format via the Viewer SDK

The new SAP BusinessObjects Enterprise BI 4.0 version of the Viewer SDK introduces a new method, the CrystalReportViewer.removeExportFormat(…) method.

Given an instance of the CrystalReportViewer, invoking the following:

crystalReportViewer.removeExportFormat(com.crystaldecisions.sdk.occa.report.exportoptions.ReportExportFormat.crystalReports);
//crystalReportViewer.removeExportFormat(com.crystaldecisions.sdk.occa.report.exportoptions.ReportExportFormat.PDF);
crystalReportViewer.removeExportFormat(com.crystaldecisions.sdk.occa.report.exportoptions.ReportExportFormat.characterSeparatedValues);
crystalReportViewer.removeExportFormat(com.crystaldecisions.sdk.occa.report.exportoptions.ReportExportFormat.editableRTF);
crystalReportViewer.removeExportFormat(com.crystaldecisions.sdk.occa.report.exportoptions.ReportExportFormat.MSWord);
crystalReportViewer.removeExportFormat(com.crystaldecisions.sdk.occa.report.exportoptions.ReportExportFormat.MSExcel);
crystalReportViewer.removeExportFormat(com.crystaldecisions.sdk.occa.report.exportoptions.ReportExportFormat.recordToMSExcel);
crystalReportViewer.removeExportFormat(com.crystaldecisions.sdk.occa.report.exportoptions.ReportExportFormat.recordToMSExcel2007);
crystalReportViewer.removeExportFormat(com.crystaldecisions.sdk.occa.report.exportoptions.ReportExportFormat.RTF);
crystalReportViewer.removeExportFormat(com.crystaldecisions.sdk.occa.report.exportoptions.ReportExportFormat.XML);

results in the following drop-down:

 

And there you have it – only the PDF export format remains.  It’s that simple!

Conclusion

I’m very happy that this enhancement made it into the product – the ability to modify the export list was one of the things frequently asked for by both external and internal coders.

Sample code for the above example is downloadable: JAVA_ENTERPRISE_BE14_CR_WEB_VIEW_REMOVE_EXPORT_FORMATS

New NetWeaver Information at SAP.com

Very Helpfull

 

 

User Rating: Be the first one !