You must configure Report Application Server
(RAS) settings before you can open a report from a file path.
Unmanaged reports can be opened from a file path
accessible to the RAS server.
Set the file path of the report you
want to open.
- If the report
is on the server, specify the file path.
String path = "C:\\Program Files (x86)\\SAP BusinessObjects\\SAP BusinessObjects Enterprise XI 4.0\\Samples\\En\\Reports\\Demonstration\\World Sales Report.rpt";
If the report is local to the client, add
rassdk:// to the beginning of the path.
Replace
<path> with the path to the report and
replace
<MyReport.rpt> with the name of the
report.
String path ="rassdk://C:\\<path>\\<MyReport.rpt>";
Create a new
ReportClientDocument object.
ReportClientDocument rcd = new ReportClientDocument();
Set the name and port of the RAS
server used to open and process the report.
rcd.setReportAppServer("hostname:port"); Call the
open
method of the
ReportClientDocument class to
open the report.
The second parameter
accepts an integer value that specifies the open options. See the
OpenReportOptions class for
details.
rcd.open(path, OpenReportOptions._openAsReadOnly);
A
ReportClientDocument object is
created that represents the report, and can be modified using the controllers
in this class.
Example:
The following code opens an unmanaged report
called
World Sales
Report.rpt from a file path accessible to the RAS server.
ReportClientDocument openUnmanagedReport() throws ReportSDKException
{
String path = "C:\\Program Files (x86)\\SAP BusinessObjects\\SAP BusinessObjects Enterprise XI 4.0\\Samples\\En\\Reports\\Demonstration\\World Sales Report.rpt";
ReportClientDocument rcd = new ReportClientDocument();
rcd.setReportAppServer("hostname:port");
rcd.open(path, OpenReportOptions._openAsReadOnly);
return rcd;
}This list includes the classes used by the sample
code:
com.crystaldecisions.sdk.occa.report.application.OpenReportOptions
com.crystaldecisions.sdk.occa.report.application.ReportClientDocument
com.crystaldecisions.sdk.occa.report.lib.ReportSDKException