Skip to Content
Dec 20, 2021 at 10:32 AM

Options on importing legacy crystal reports

480 Views Last edit Dec 21, 2021 at 01:36 AM 5 rev

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:

  • Crystal Reports for Enterprise 4.0
  • SAP BusinessObjects Enterprise XI 4.0

The list of SAP products I can start:

  • SAP Crystal Reports 2016 SP 8
  • SAP Crystal Reports for Enterprise - v ersion / 2016 SP 8

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>    


<message>Unsupported report type: 

only Crystal Reports for Enterprise reports are supported in REST API. (CRR 00095)


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>"Came here (2-A)");<br>    
String pathToPdf = pathToReportFile.replace(".rpt", ".pdf");<br>"Path to PDF: " + pathToPdf);<br>    
File pdfFile = new File(pathToPdf);<br>    
ReportClientDocument reportClientDoc = null;<br>    try {<br>"Came here (2-B)");<br>"Trying to open report document (template): " + pathToReportFile);<br>        
File templateFile = new File(pathToReportFile);<br>        
if (templateFile.exists()) {<br>   "Came here (2-C)");<br><br>            
ReportAppSession reportAppSession = new ReportAppSession();<br>            
// Where in unmanaged RAS, you’d connect to the RAS server via:<br>            
reportAppSession.initialize();<br>   "Came here (2-D)");<br><br>            
reportClientDoc = new ReportClientDocument();<br>            
// set default Locale, must be set before opening client<br>            
reportClientDoc.setLocale(DEFAULT_LOCALE);<br>   , 0);<br>   "Came here (2-E)");<br>            
reportClientDoc.enableBuiltinControllers();<br>   "Came here (2-F)");<br><br>            
setDBConnectionParams(reportClientDoc, reportJobDTO);<br>            
setReportParamsValues(reportClientDoc, reportJobDTO.getParametersAsMap());<br>   "Came here (2-G)");<br><br>            
ByteArrayInputStream generatedReport = (ByteArrayInputStream) 
reportClientDoc.getPrintOutputController().export(asReportExportFormat(reportFormat));<br>   "Came here (2-H)");<br>            
writeToFile(generatedReport, pdfFile);<br>   "Came here (2-I)");<br>            
generatedReport.close();<br>   "Came here (2-J)");<br>        } else {<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>       "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,