September 9 11, 2013 Anaheim, California SAP Crystal Reports SDK Adding Reporting to Your Custom Applications (0304) Mandeep Jassal
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 Common Use Cases for the SAP Crystal Reports SDKs
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 Free versions vs. Paid with CR Designer.
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) Link to external site
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) REST (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 Use Viewer SDK to customize viewer
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); reportclientdoc.getdatabasecontroller().settablelocation(origtable, newtable);
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] crystalreportpageviewer.setreportsource(reportclientdoc.reportsource):
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); clientdoc.getprintoutputcontroller().export(exportoptions);
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();
Key Learning's and Call To Action 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 12
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 http://scn.sap.com/community/crystal-reports-for-eclipse
Appendix
SAP BusinessSuite (CR.NET WinForm)
SAP LVM (CR.NET ASP.NET WebForm)
SAP ByDesign (CR Java DHTML viewer)
Thank you for participating. Please provide feedback on this session by completing a short survey via the event mobile application. SESSION CODE: 0304 Learn more year-round at www.asug.com