September 9–11, 2013
Anaheim, California
SAP Crystal Reports SDK – Adding Reporting to Your Custom
Applications (0304)
Key Learning Points
Brief History of SAP Crystal Reports SDKs
Showcase of Solutions using the SAP Crystal Reports SDKs
SAP Crystal Reports SDKs Available Today
Brief History
Definition: Software Development Kit
A software development kit (SDK or "devkit") is typically a set of
development tools that allows for the creation of applications for a
certain software package, software framework, hardware platform,
computer system, video game console, operating system, or similar
platform.
First Crystal Reports SDKs
CRPE, VCL, and VBX/OCX controls
Standalone report designer
Report Designer Component (RDC) COM/ActiveX
SAP Crystal Reports for .NET
Java versions also released
Showcase of Solutions using the SDKs
SAP Business Suite (CR .NET WinForm)
SAP Landscape Virtualization Management (CR .NET WebForm)
SAP ByDesign (CR Java DHTML viewer)
AANDC (using RAS with the BI Platform)
SAP Crystal Reports SDKs Available Today
SAP Crystal Reports for .NET / SAP Crystal Reports for Eclipse
Visual Studio 2002 – 2012 / Eclipse 3.4-3.7
Embedded Report Designer
In-Process SDK & Runtime, including viewers
Report Application Server (RAS)
Designed to be used with BI Platform
SDK & Runtime, with out-of-proc server
Viewer SDK
WinForm, ASP.NET (DHTML), WPF, Java DHTML
JavaScript (BI4.0 FP03)
Common CR SDK Use Cases
Setting user credentials for the report’s data source
Setting values for parameters
Display report in viewer
Export report to other formats
Setting user credentials for the report’s data source
Required for secured databases
[.NET]
ConnectionInfo connectionInfo = new ConnectionInfo();
connectionInfo.ServerName = SERVER_NAME;
connectionInfo.DatabaseName = DATABASE_NAME;
connectionInfo.UserID = DB_USER_NAME;
connectionInfo.Password = DB_PASSWORD;
TableLogOnInfo tableLogonInfo = table.LogOnInfo;
tableLogonInfo.ConnectionInfo = connectionInfo;
table.ApplyLogOnInfo(tableLogonInfo);
[Java]
connectionInfo = newTable.getConnectionInfo();
propertyBag = new PropertyBag();
propertyBag.put(“Database Class Name”, DATABASE_CLASS_NAME);
propertyBag.put(“Server Name”, SERVER_NAME);
propertyBag.put(“Database Name”, DATABASE_NAME);
connectionInfo.setAttributes(propertyBag);
connectionInfo.setUserName(DB_USER_NAME);
connectionInfo.setPassword(DB_PASSWORD);
Setting values for parameters
Use Parameters fields to prompt user for input that can be used
to filter data
[.NET]
ParameterValues currentParameterValues = new ParameterValues();
ParameterDiscreteValue parameterDiscreteValue = new ParameterDiscreteValue(); parameterDiscreteValue.Value = newValue; currentParameterValues.Add(parameterDiscreteValue); ParameterFieldDefinition parameterFieldDefinition = reportDocument.DataDefinition.ParameterFields[PARAMETER_FIELD_NAME]; parameterFieldDefinition.ApplyCurrentValues(currentParameterValues); [Java]
ParameterFieldDiscreteValue newDiscValue = new ParameterFieldDiscreteValue(); newDiscValue.setValue(newValue);
clientDoc.getDataDefController().getParameterFieldController().setCurrentValue(reportName, parameterName , newValue);
Display report in viewer
Displaying the report in the runtime viewer
similar for all viewers
[.NET]
crystalReportViewer1.ReportSource = reportDoc;
[Java]
Export report to other formats
Providing report in other common formats
PDF, Microsoft Word/Excel, RTF, CSV, and more
[.NET]
ExportOptions exportOpts = new ExportOptions();
PdfFormatOptions exportPDFOpts = ExportOptions.CreatePdfFormatOptions(); exportOpts.ExportFormatOptions = exportPDFOpts;
reportDoc.ExportToHttpResponse(exportOpts, this.Response, true, "crystalreport.pdf");
[Java]
PDFExportFormatOptions pdfOptions = new PDFExportFormatOptions(); ExportOptions exportOptions = new ExportOptions();
exportOptions.setExportFormatType(ReportExportFormat.PDF); exportOptions.setFormatOptions(pdfOptions);
Use Viewer SDK to customize viewer
Display/Hide toolbar buttons
Provide custom toolbar (ie: page navigation)
[.NET]
//Customize toolbar
crystalReportViewer.HasExportButton = true; crystalReportViewer.HasPrintButton = false; crystalReportViewer.HasRefreshButton = false; //Custom page navigation
crystalReportViewer.ShowNextPage(); crystalReportViewer.ShowLastPage(); crystalReportViewer.ShowPreviousPage(); crystalReportViewer.ShowFirstPage(); [Java] //Customize toolbar crystalReportPageViewer.hasRefreshButton(); crystalReportPageViewer.hasExportButton(); crystalReportPageViewer.hasPrintButton(); //Custom page navigation
crystalReportPageViewer.showFirstPage(); crystalReportPageViewer.showLastPage(); crystalReportPageViewer.showPreviousPage(); crystalReportPageViewer.showFirstPage();
12
How reporting is being used in solutions today
SAP Crystal Report SDKs have evolved with changing technologies
and architectures
The basic needs for integrating reporting into your applications
Next Steps:
Download and use the SAP Crystal Reports SDKs in your solutions
Visit the SAP Community Network (SCN) for articles and samples
Resources
Download Sample Apps & Reports
http://www.sdn.sap.com/irj/boc/samples
CR .NET and CR Java SCN Portal Pages
http://scn.sap.com/community/crystal-reports-for-visual-studio
Thank you for participating.
Please provide feedback on this session by
completing a short survey via the event
mobile application.
SESSION CODE: 0304