Hello SAP-Experts,
I'd like to know if there's a way to re-use legacy crystal reports that were created through Java API methods from 'com.businessobjects' library in version 12.2.220.
Right now our applications use that embedded legacy crystal reports engine but we would like to let the SAP BO or SAP CR Server do the job for us and remove the dependency on BO/CR libraries.
The following programs that I can see on our dedicated server and for which we bought licences are:
The list of SAP products I can start:
None of them seem to allow us to import or somehow convert oldish reports.
Other options I tried was using the RESTful webservice which allowed me to connect & obtain a security token from the server and also upload .rpt-files (oh joy!). But I haven't been successful to export an exemplary blank report (with nothing in it) as a PDF that we've created with our Java application for modeling crystal reports.
The error sent back from the server is:
<?xml version="1.0" encoding="UTF-8" standalone="no"?><br><error><br> <error_code>403</error_code><br> <message>Unsupported report type: only Crystal Reports for Enterprise reports are supported in REST API. (CRR 00095) </message><br></error>
However, we are curious to know if there are other ways to process our legacy reports. We're sitting on several hundreds of report templates that we would not like to rebuild from scratch.
The next thing I am trying is through the implementation of a small Java application (with the latest java libraries from
C:\Program Files (x86)\SAP Business Objects\SAP BusinessObjects Enterprise XI 4.0\java\lib.
C:\Program Files (x86)\SAP Business Objects\SAP BusinessObjects Enterprise XI 4.0\java\lib\external.
as mentioned here: JAR files needed for deployment of SAP BusinessObjects software
in order to test and see if it's possible to somehow process or even export a blank report.
Here's the code which I'm currently working on:
public static void generateReportFromTemplateFileDirectly(@NotNull JobDto reportJobDTO, @NotNull ReportDocDTO reportDoc, @NotNull ReportFormat reportFormat) throws de.psilog.ReportException,<br> NullPointerException, IOException {<br><br> String pathToReportFile = reportDoc.getFullPath(); // e.g. "C:/Reports/BlankReport.rpt"<br> if (!pathToReportFile.endsWith(".rpt")) {<br> throw new IllegalArgumentException("Report file does not end with .rpt!");<br> }<br> log.info("Came here (2-A)");<br> String pathToPdf = pathToReportFile.replace(".rpt", ".pdf");<br> log.info("Path to PDF: " + pathToPdf);<br> File pdfFile = new File(pathToPdf);<br> ReportClientDocument reportClientDoc = null;<br> try {<br> log.info("Came here (2-B)");<br> log.info("Trying to open report document (template): " + pathToReportFile);<br> File templateFile = new File(pathToReportFile);<br> if (templateFile.exists()) {<br> log.info("Came here (2-C)");<br><br> ReportAppSession reportAppSession = new ReportAppSession();<br> // https://blogs.sap.com/2009/01/19/crystal-report-for-eclipse-version-2-released/<br> // Where in unmanaged RAS, you’d connect to the RAS server via:<br> reportAppSession.createService("com.crystaldecisions.sdk.occa.report.application.ReportClientDocument");<br> reportAppSession.setReportAppServer(ReportClientDocument.inprocConnectionString);<br> reportAppSession.initialize();<br> log.info("Came here (2-D)");<br><br> reportClientDoc = new ReportClientDocument();<br> reportClientDoc.setReportAppSession(reportAppSession);<br> reportClientDoc.setReportAppServer("localhost");<br> // set default Locale, must be set before opening client<br> reportClientDoc.setLocale(DEFAULT_LOCALE);<br> reportClientDoc.open(pathToReportFile, 0);<br> log.info("Came here (2-E)");<br> reportClientDoc.enableBuiltinControllers();<br> log.info("Came here (2-F)");<br><br> setDBConnectionParams(reportClientDoc, reportJobDTO);<br> setReportParamsValues(reportClientDoc, reportJobDTO.getParametersAsMap());<br> log.info("Came here (2-G)");<br><br> ByteArrayInputStream generatedReport = (ByteArrayInputStream) reportClientDoc.getPrintOutputController().export(asReportExportFormat(reportFormat));<br> log.info("Came here (2-H)");<br> writeToFile(generatedReport, pdfFile);<br> log.info("Came here (2-I)");<br> generatedReport.close();<br> log.info("Came here (2-J)");<br> } else {<br> log.debug(TEMPLATE_FILE_DOESNT_EXIST_MSG);<br> throw new IOException();<br> }<br> } catch (ClassNotFoundException | IllegalAccessException | InstantiationException | ReportSDKException | de.psilog.ReportException e) {<br> log.error(REPORT_NOT_GENERATED_MSG, e);<br> throw new de.psilog.ReportException(getRootExceptionMessage(e) + " - Specific error: " + e.getMessage(), e);<br> } finally {<br> try {<br> if (reportClientDoc != null) {<br> log.info("Closing reportClientDoc.");<br> reportClientDoc.close();<br> }<br> } catch (ReportSDKException e) {<br> log.debug(CLOSING_REPORT_DOC_FAILED_MSG, e);<br> } catch (Exception ex){<br> log.error("Failed to close report document: "+ ex.getMessage());<br> }<br> }<br>}
Due to various firewalls in our company, I simply let the Java app run as executable jar in a command shell directly on that server, so localhost would be the right host, me thinks.. Would the port 6400 be required too, here?
Anyway, I'm not entirely sure how to set the report application server via setReportAppServer("localhost") since the executed jar will terminate with an error: "User cannot change the Report Application Server once the document is opened or created."
I am not even sure if this is all a dead end, so I'd like to know what approach would be easiest with the least amount of work so we can re-use our existing reports.
Would it even be possible to convert our CR reports (version 12.2.220) or write Java code to load + save them into a newer format?
Any ideas are welcome.
Best regards,
Marcel