Web Central contains an example of how add-in managers can use Crystal Reports with Web Central. The example is located in this folder: \schema\ab-products\solutions\common\crystal\main\crystal.
Create your report using SAP Crystal Reports 2013. See https://global.sap.com/campaign/ne/free_trial/crystal_reports_2013/index.epx?kNtBzmUK9zU
If you have reports created from older versions of Crystal Reports, you will need to convert them to new format by opening and saving them using SAP Crystal Reports 2013.
You can add Crystal Reports to your own Process Navigator or Home Pages by adding an ARCHIBUS Process Tasks record. When doing so so, enter a Web URL task in the form:
ab-ex-crystal-reports-opener.axvw?filename=<report
file name>.rpt
An example is shown below.
When the user selects the item, it will load embedded within a frame in an ARCHIBUS view.
The above-referenced example applies arbitrary VPA restrictions by
replacing the original SQL generated by Crystal Reports SDK with SQL
that is produced by the
DataSource.formatSqlQuery()
method.
This method applies VPA restrictions from the current user account and user role.
/** API of a service that integrates Crystal Report SDK with WebCentral.
User must be authenticated to access all methods. This is
implemented by configuring SecurityInterceptor
to intercept all method
calls.
public interface ICrystalReportsService {
/**
* Generates PDF report using .rpt file specified by reportFileName. Applies VPA restrictions
* from the current user account if applyVpa is true.
*
* @param reportFileName name of .rpt file with report definition.
* @param applyVpa If true, applies VPA restrictions from the current user account.
* @param clientRestriction restriction passed from client-side
* @return FileTransfer which contains stream with generated PDF. DWR will write that stream
* into HTTP response.
* @throws ExceptionBase if Crystal Report SDK throws an exception or JDBC throws SQLException.
*/
FileTransfer generateReport(final String reportFileName, boolean applyVpa,final String clientRestriction) throws ExceptionBase;
}
The method:
The test view that exercises the API is located here: schema\ab-products\solutions\common\src\main\com\archibus\app\solution\common\report\crystal\ab-ex-crystal-reports.axvw
It has an edit box, in which users can enter the name of the .rpt file.
The user can click on "Invoke CrystalReportsService" button. This
button invokes a corresponding JS method in the
ab-ex-crystal-reports.js
file, which in turn invokes the
CrystalReportsService.generateReport(filename, applyVpa, clientRestriction)
WebCentral DWR service.
The view shows the generated PDF report in an IFRAME inside of
crystalReportConsole
.
The Java source code of the example is located in schema/ab-products/solutions/common/src/main/com/archibus/app/solution/common/report/crystal folder.
You might want to modify the example to handle sub-reports, to pass parameters from the view, etc.
Users can enter an SQL restriction, such as, wo.wo_type='OD'
, in the "Client-side Restriction" field to show only the records that meet this restriction.
The user can click on "Show Crystal Report" button or any of the tree nodes.
This click event will invoke a corresponding JS method crystalReportsConsole_onInvokeCrystalReportsService
in the ab-ex-crystal-reports-tree.js file, which in turn invokes the CrystalReportsService.generateReport(filename, applyVpa, clientRestriction)
WebCentral DWR service.
An example view is located at: schema/ab-products/solutions/common/src/main/com/archibus/app/solution/common/report/crystal/ab-ex-crystal-reports-tree.axvw
If the user clicks on "Show Crystal Report" button, all wr records will display in Crystal Reports.
If the user clicks on tree node on the bottom left panel, a subset of wr records will display in Crystal Reports.
The view shows the generated PDF report of Crystal Report on the right bottom panel.
Users can enter or select value for all fields in a console panel and then click the "Show Crystal Report" button. This invokes a corresponding JS method crystalReportsConsole_onInvokeCrystalReportsService
in the ab-ex-crystal-reports-tree.js file, which in turn invokes the CrystalReportsService.generateReport(filename, applyVpa, clientRestriction)
WebCentral DWR service.
The view shows the generated PDF report of Crystal Report on the bottom panel.
An example view is located at: schema/ab-products/solutions/common/src/main/com/archibus/app/solution/common/report/crystal/ab-ex-crystal-reports-console.axvw
You can use Crystal Reports with subreports from multiple tables.
For information, see the sample view : http://localhost:8080/archibus/schema/ab-products/solutions/common/src/main/com/archibus/app/solution/common/report/crystal/ab-ex-crystal-reports-multitables.axvw. The user clicks the Invoke CrystalReportService button, and the view generates the Crystal Report PDF and shows it in the bottom panel.
Once the user selects the" Invoke CrystalReportService" button, the system invokes the JS method crystalReportsConsole_onInvokeCrystalReportsService
in the ab-ex-crystal-reports-multitables.js
file, which in turn invokes the CrystalReportsService.generateReport(filename, applyVpa, clientRestriction)
WebCentral DWR service.
SAP has published the following troubleshooting tips for using their Crystal Reports library.
Copyright © 1984-2015, ARCHIBUS, Inc. All rights reserved. |