Crystal Reports for Eclipse Developer Guide

To set parameter values

You must complete the lesson To create a new Crystal Reports Java project before you can complete the steps in this lesson.
  1. Add the following code snippet to the end of the try block in the main method to display the report.
    This code snippet creates a ReportViewerBean object, initializes it, and sets its report source. It then adds the ReportViewerBeanto the content pane and calls the start method to display the report.
    ReportViewerBean reportViewerBean = new ReportViewerBean();
    reportViewerBean.init();
    reportViewerBean.setReportSource(reportClientDocument.getReportSource());
        
    CrystalParameterExample frame = new CrystalParameterExample();
    frame.getContentPane().add(reportViewerBean, BorderLayout.CENTER);
    Insets insets = frame.getInsets();
    frame.setSize(insets.left + 700 + insets.right, insets.top + 500 + insets.bottom);
    frame.setLocationByPlatform(true);
    frame.setVisible(true);
    
    reportViewerBean.start();
    The main method should look like this:
    public static void main(String[]args)  
    { 
      try
      {
        ReportClientDocument reportClientDocument = new ReportClientDocument();
        reportClientDocument.setReportAppServer(ReportClientDocument.inprocConnectionString);
        reportClientDocument.open("Sample Reports\\Customer Profile Report.rpt", OpenReportOptions._openAsReadOnly);
    
        reportClientDocument.getDataDefController().getParameterFieldController().setCurrentValue("", "Customer Region", "Argentina");
    
        ReportViewerBean reportViewerBean = new ReportViewerBean();
        reportViewerBean.init();
        reportViewerBean.setReportSource(reportClientDocument.getReportSource());
        
        CrystalParameterExample frame = new CrystalParameterExample();
        frame.getContentPane().add(reportViewerBean, BorderLayout.CENTER);
        Insets insets = frame.getInsets();
        frame.setSize(insets.left + 700 + insets.right, insets.top + 500 + insets.bottom);
        frame.setLocationByPlatform(true);
        frame.setVisible(true);
    
        reportViewerBean.start();
      }
      catch (ReportSDKException e)
      {
        e.printStackTrace();
      }
    }



SAP BusinessObjects
http://www.sap.com/sapbusinessobjects/
Support services
http://service.sap.com/bosap-support/
Product Documentation on the Web
http://help.sap.com/