Ajay Kumar
Ajay Kumar

Reputation: 1164

Crystal Reports Maximum report processing jobs limit reached

I am using Crystal Reports 13.5 in ASP.NET web forms app. I tried putting the Close() and Dispose() calls in the Page_Unload method, but it did not help.

After 75 reports, I start getting error:

The Maximum report processing jobs limit configured by your system administrator has been reached.

Should I purchase a license for Business Object?

Upvotes: 1

Views: 15054

Answers (5)

Ashif Pathan
Ashif Pathan

Reputation: 1

In design view remove any crystal report viewer control if placed and put below code

<div id="divPDFView" runat="server" >
</div>

Dont forget to create folder "PDFExports" in root

Just call below function to show report. (Replace values with your values where '?' is placed and report should be in folder named "Reports" )

private void ShowReport()
{
                ReportDocument rd = new ReportDocument();
    
                rd.Load(Path.Combine(Server.MapPath("~/Reports"), "?ReportName.rpt"));
    
                //@@: Record Selection formula
                //rd.RecordSelectionFormula = "???";
    
                rd.SetDatabaseLogon(?UserId, ?Password, ?DbServer, "");
    
                //@@: Parameters
                //rd.SetParameterValue("cpf_1", "");  //String
                //rd.SetParameterValue("cpf_2", Convert.toInt32("1"));  //Int
    
                //@@: Parameters to Subreport
                //rd.SetParameterValue("cpf_????", "", rd.Subreports[0].Name);
    
                //@@: Set Title
                //rd.SummaryInfo.ReportTitle = "Report as on " + DateTime.Today.Day + "-" + DateTime.Today.Month + "-" + DateTime.Today.Year;
    
                //I use it for unique file names.. you can avoid it..
                Guid g = Guid.NewGuid();
                string strFileName = "?zReportName_" + DateTime.Now.ToString("yyyyMMdd-HHmmss") + "_" + Session["userId"].ToString() + "_" + g.ToString() + ".pdf";
                rd.ExportToDisk(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat, Path.Combine(Server.MapPath("~/PDFExports"), strFileName));
    
                divPDFView.InnerHtml = "<object data=\"PDFExports/" + strFileName + "\" type=\"application/pdf\" width=\"1230\" height=\"880\">  alt : <a href=\"PDFExports\\a.pdf\">PDF File</a> </object>";
    
                rd.Dispose();
                rd.Close();
}

Upvotes: 0

Ashif Pathan
Ashif Pathan

Reputation: 1

It's too late, but I found a solution but with a different angle. You can generated PDF directly and display it in . By doing this, you can also close rd object after use...

Upvotes: 0

Code
Code

Reputation: 749

using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using CrystalDecisions;
using CrystalDecisions.CrystalReports;
using CrystalDecisions.CrystalReports.Engine;
 
namespace Test.Utilities
{
    public class ReportFactory
    {
        protected static Queue reportQueue = new Queue();
 
        protected static ReportClass CreateReport(Type reportClass)
        {
            object report = Activator.CreateInstance(reportClass);
            reportQueue.Enqueue(report);
            return (ReportClass)report;
        }
 
        public static ReportClass GetReport(Type reportClass)
        {
 
            //75 is my print job limit.
            if (reportQueue.Count > 75) ((ReportClass)reportQueue.Dequeue()).Dispose();
            return CreateReport(reportClass);
        }
    }
}

Upvotes: 0

Matheus Lemos
Matheus Lemos

Reputation: 628

It worked for me by Disposing the report and then calling GC.Collect(). Only Disposing the object wasn't enough in my case. Check this for full details.

EDIT: As per Div's comment, here's the solution from the link:

  • Load report
  • Assign to Viewer Control
  • Show Report in Viewer Control
  • Close Viewer Control and Unload (completely)
  • Then close/dispose/gc.collect outside of any viewer control code

Upvotes: 1

Deepak Joshi
Deepak Joshi

Reputation: 1066

Crystal print engine is designed with 75 as a default print job limit. Once this limit exceeds, above issues start to appear.

This problem quite easily, by altering one value in the registry:

HKEY_LOCAL_MACHINE\SOFTWARE\SAP BusinessObjects\Crystal Reports for .NET Framework 4.0\Report Application Server\InprocServer

For more information please look into below link

http://scn.sap.com/community/crystal-reports-for-visual-studio/blog/2014/04/25/what-exactly-is-maximum-report-processing-job-limit-for-crystal-reports

Upvotes: -1

Related Questions