Crystal Reports for Eclipse Developer Guide

To view a report using the ReportViewerBean class

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 of the main method.
    This code snippet creates a ReportViewerBean object, initializes it, and sets its report source. It then adds the ReportViewerBean to the content pane and calls the start method to display the report:
    ReportViewerBean reportViewerBean = new ReportViewerBean();
    reportViewerBean.init();
    reportViewerBean.setReportSource(reportClientDocument.getReportSource());
        
    CrystalOpenExample frame = new CrystalOpenExample();
    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\\Custom Functions.rpt", OpenReportOptions._openAsReadOnly);
    
        ReportViewerBean reportViewerBean = new ReportViewerBean();
        reportViewerBean.init();
        reportViewerBean.setReportSource(reportClientDocument.getReportSource());
        
        CrystalOpenExample frame = new CrystalOpenExample();
        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/