My task is to create an "app" that will allow the following: given a list of Crystal Reports on the server, the user can select any number of them to combine into one long report (just appended together). They must be able to set the parameters for each report.
I've gathered that the usual method would be to generate a main report that includes all of the individual reports as subreports, but I don't believe this is an option here, because some of the individual reports may already contain their own subreports (and you can't have nested subreports).
The reports were created with Crystal Reports for Enterprise XI 4.0. I'm trying to do this as a set of JSP pages using the BusinessObjects Java SDK. Preferably the output type would be flexible, but if necessary, just generating a PDF would be acceptable.
What would be the best way to go about this?
UPDATE: I should also note that, when attempting to export a single report to PDF (I was considering just making PDFs of every report and then concatenating them somehow), the following code fails:
// Get the ID of the current working report.
int reportID = Integer.parseInt(request.getParameter("ReportID"));
// Retrieve the BOE Session and InfoStore objects
IEnterpriseSession eSession = (IEnterpriseSession)session.getAttribute("EnterpriseSession");
IInfoStore iStore = (IInfoStore)eSession.getService("InfoStore",ServiceNames.OCA_I_IINFO_STORE);
// Query to get the report document
String infoStoreQuery = "select SI_NAME,SI_PARENTID from CI_INFOOBJECTS where SI_ID=" + reportID;
IInfoObjects infoObjects = iStore.query(infoStoreQuery);
IInfoObject report = (IInfoObject)infoObjects.get(0);
IReportAppFactory reportAppFactory = (IReportAppFactory)eSession.getService("RASReportFactory");
ReportClientDocument clientDoc = reportAppFactory.openDocument(report, OpenReportOptions._openAsReadOnly, java.util.Locale.CANADA);
//Use the report document's PrintOutputController to export the report to a ByteArrayInputStream
ByteArrayInputStream byteIS = (ByteArrayInputStream)clientDoc.getPrintOutputController().export(ReportExportFormat.PDF);
clientDoc.close();
//Create a byte[] that is the same size as the exported ByteArrayInputStream
byte[] buf = new byte[2000 * 1024];
int nRead = 0;
//Set response headers
response.reset();
response.setHeader("content-disposition", "inline;filename=untitled.pdf");
response.setContentType("application/pdf");
//Send the Byte Array to the Client
while ((nRead = byteIS.read(buf)) != -1) {
response.getOutputStream().write(buf, 0, nRead);
}
//Flush the output stream
response.getOutputStream().flush();
//Close the output stream
response.getOutputStream().close();
On the "reportAppFactory.openDocument" line, with this error:
javax.servlet.ServletException: com.crystaldecisions.sdk.occa.managedreports.ras.internal.ManagedRASException: Cannot open report document. --- This release does not support opening SAP Crystal Reports for Enterprise reports.
So if you don't have a better solution to the overall problem, I would still appreciate some help on even exporting one report to PDF.