Solved

Crystal Reports XI - The request could not be submitted for background processing

Posted on 2008-10-27
19
3,149 Views
Last Modified: 2013-11-15
I have a VB program (code below)  that generates a .RPT report, exports it to a PDF and emails out a link to that PDF. The program runs on Server 2003 which has the CR Engine installed (don't know how to check the version/service pack on it).

I was getting a "Load report failed" error but now I'm getting the one in the title.  When I check the Event Log I get the following message:

"Error during report execution (main try-catch): Load report failed.Error in File C:\DOCUME~1\MyUserAccount\LOCALS~1\Temp\TheReport {5E867B68-3AB8-48C0-9305-A16AF4CED465}.rpt:
The request could not be submitted for background processing..  C:\Reports"

Any ideas on what could be causing this?

I tried to go to the Business Objects site and download SP4 for the engine but pretty much all their links are broken.  As a starting point if anyone can tell me how to verify my version on the engine and give me a good link for SP4 that might do it.

Thanks for any input.


Imports System.Data
Imports System.Data.SqlClient
Imports CrystalDecisions.CrystalReports.Engine
 
Module TheReport
 
 
    Sub Main(ByVal args() As String)
 
        Dim startdate As DateTime
        Dim enddate As DateTime
 
        If args.Length = 0 Then
            Dim evtLog As New EventLog("Application")
            evtLog.Source = "TheReport Execution"
            evtLog.WriteEntry("No Report Type Defined.", EventLogEntryType.Error)
            evtLog.Close()
            evtLog.Dispose()
            Exit Sub
        End If
 
        Dim reporttype As String = UCase(args(0))
        reporttype = (StrConv(reporttype, VbStrConv.ProperCase))
 
 
        If UCase(args(0)) = "DAILY" Then
            startdate = "#" & Today.ToShortDateString & " 00:00:00 AM#"
            enddate = "#" & Today.ToShortDateString & " 11:59:59 PM#"
        Else
            enddate = "#" & DateAdd("d", -1, Today.ToShortDateString) & " 11:59:59 PM#"
            startdate = "#" & DateAdd("d", -7, Today.ToShortDateString).ToShortDateString & " 00:00:00 AM#"
        End If
 
        Dim TodayString As String = Today.Month.ToString & "-" & Today.Day.ToString & "-" & Today.Year.ToString
        Dim LastWeek As String = DateAdd("d", -7, Today.ToShortDateString).ToShortDateString
        LastWeek = Replace(LastWeek, "/", "-")
 
 
      
        Dim rptSP As ReportDocument = New ReportDocument
 
        Try
            rptSP.Load(System.Environment.CurrentDirectory & "\TheReport.rpt", 0)
            rptSP.DataSourceConnections(0).SetConnection("MyServer\MyInstance", "MyDatabase", True)
 
            Dim vals As New CrystalDecisions.Shared.ParameterValues()
            Dim x As New CrystalDecisions.Shared.ParameterDiscreteValue()
            x.Value = startdate
            Dim y As New CrystalDecisions.Shared.ParameterDiscreteValue()
            y.Value = enddate
            vals.Add(x)
 
            rptSP.DataDefinition.ParameterFields("StartDate").ApplyCurrentValues(vals)
            vals.Clear()
            vals.Add(y)
            rptSP.DataDefinition.ParameterFields("EndDate").ApplyCurrentValues(vals)
 
            Dim norecords As Boolean = False
            Try
                If UCase(args(0)) = "DAILY" Then
                    rptSP.ExportToDisk(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat, "D:\Reports\" & reporttype & "MyReport" & TodayString & ".pdf")
                Else
                    rptSP.ExportToDisk(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat, "D:\Reports\" & reporttype & "MyReport" & LastWeek & ".pdf")
                End If
 
                If rptSP.Rows.Count = 0 Then
                    norecords = True
                    rptSP.Dispose()
                End If
                rptSP.Close()
                rptSP.Dispose()
            Catch ex As Exception
                norecords = True
                Dim evtLog As New EventLog("Application")
                evtLog.Source = "TheReport Execution"
                evtLog.WriteEntry("Error during report generation (Export To Disk Block): " & ex.Message & ".  " & System.Environment.CurrentDirectory, EventLogEntryType.Error)
                evtLog.Close()
                evtLog.Dispose()
                Try
                    rptSP.Close()
                    rptSP.Dispose()
                Catch exs As Exception
                    Dim evtLog2 As New EventLog("Application")
                    evtLog2.Source = "TheReport Execution"
                    evtLog2.WriteEntry("Error during report generation (Close/Dispose of Report): " & ex.Message & ".  " & System.Environment.CurrentDirectory, EventLogEntryType.Error)
                    evtLog2.Close()
                    evtLog2.Dispose()
                End Try
            End Try
 
            Dim mail As New System.Net.Mail.MailMessage("reportserver@mydomain.com", "test@mydomain.com")
 
            If UCase(args(0)) = "DAILY" Then
                mail.Subject = "Daily Report"
            Else
                mail.Subject = "Weekly Report"
            End If
 
            If norecords Then
                If UCase(args(0)) = "DAILY" Then
                    mail.Body = "No Seizures Entered For " & Today
                Else
                    mail.Body = "No Seizures Entered For The Week Starting " & DateAdd("d", -7, Today.ToShortDateString).ToShortDateString
                End If
            Else
                If UCase(args(0)) = "DAILY" Then
                    mail.Body = "Click the link below to access the Daily Report for " & Today & Environment.NewLine & Environment.NewLine & "http://mydomain/Reports/" & reporttype & "Report" & TodayString & ".pdf"
                Else
                    mail.Body = "Click the link below to access the Weekly Report for the week starting " & DateAdd("d", -7, Today) & Environment.NewLine & Environment.NewLine & "http://mydomain/Reports/" & reporttype & "Report" & LastWeek & ".pdf"
                End If
 
 
            End If
 
            Dim cn As New SqlConnection("Data Source=MyDatabase\MyInstance;Initial Catalog=MyDatabase;Integrated Security=SSPI;")
            Dim cmd As SqlCommand = cn.CreateCommand
            cn.Open()
            If UCase(args(0)) = "DAILY" Then
                cmd.CommandText = "SELECT emailaddy FROM theusers WHERE daily=1 "
            Else
                cmd.CommandText = "SELECT emailaddy FROM theusers WHERE weekly=1""
            End If
            Dim rdr As SqlDataReader = cmd.ExecuteReader
            While rdr.Read
                Try
                    mail.To.Add(rdr("email"))
                Catch ex As Exception
                    Dim evtLog As New EventLog("Application")
                    evtLog.Source = "TheReport Execution"
                    evtLog.WriteEntry("Error during report execution (while adding main recipients): " & ex.Message & ".  " & System.Environment.CurrentDirectory, EventLogEntryType.Error)
                    evtLog.Close()
                    evtLog.Dispose()
                End Try
 
            End While
            rdr.Close()
            cn.Close()
 
            Try
                If UCase(args(0)) = "WEEKLY" Then
                    Dim s As New IO.StreamReader("people.txt")
                    While Not s.EndOfStream
                        Try
                            mail.CC.Add(s.ReadLine)
                        Catch ex As Exception
                            Dim evtLog As New EventLog("Application")
                            evtLog.Source = "TheReport Execution"
                            evtLog.WriteEntry("Error during report execution (while adding extra people): " & ex.Message & ".  " & System.Environment.CurrentDirectory, EventLogEntryType.Error)
                            evtLog.Close()
                            evtLog.Dispose()
                        End Try
                    End While
                    s.Close()
                End If
            Catch ex As Exception
            End Try
 
            If mail.To.Count > 0 Then
                Dim smtpMe As New System.Net.Mail.SmtpClient()
                smtpMe.Host = "mysmtpserver"
                smtpMe.Send(mail)
            End If
 
        Catch ex As Exception
            Dim evtLog As New EventLog("Application")
            evtLog.Source = "TheReport Execution"
            evtLog.WriteEntry("Error during report execution (main try-catch): " & ex.Message & ex.InnerException.Message & ".  " & System.Environment.CurrentDirectory, EventLogEntryType.Error)
            evtLog.Close()
            evtLog.Dispose()
        Finally
            Try
                rptSP.Close()
                rptSP.Dispose()
            Catch ex As Exception
            End Try
        End Try
 
    End Sub
 
End Module

Open in new window

0
Comment
Question by:synapse88
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 8
  • 8
19 Comments
 
LVL 70

Expert Comment

by:Éric Moreau
ID: 22815906
which line is causing the error?
0
 

Author Comment

by:synapse88
ID: 22816036
I can't tell that.  The only error information I have is what I posted in the question.  If there's some code I can add which will give me more exception information just let me know and I'll add it and run the program again.
0
 
LVL 70

Expert Comment

by:Éric Moreau
ID: 22816066
remove your try catch to debug.
0
Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

 

Author Comment

by:synapse88
ID: 22816079
I don't follow.  The Try Catch (and associated exception handling) is the only way I'm able to get the error info I posted above.  Without that it will just error out with no exception info (that I know of).
0
 
LVL 70

Expert Comment

by:Éric Moreau
ID: 22816179
You don't have this error on your own computer? Only when it runs on the server? If that's the case, to find out which line you can use tracing (see http://www.emoreau.com/Entries/Articles/2003/11/Code-diagnostic-an-article-on-tracing-and-debugging.aspx) or add messagebox in your application to find out which line.
0
 
LVL 70

Expert Comment

by:Éric Moreau
ID: 22816205
I had this error once a while ago and it was because I was missing one CR DLL file (but I don't remember which one).
0
 

Author Comment

by:synapse88
ID: 22816258
I was thinking that might be the case, that's why I was hoping someone might be able to help determining what version of the CR engine running and how to install the SP4 for it.

0
 

Author Comment

by:synapse88
ID: 22816404
Ok when I comment out the code I attached below, it works just fine
            Dim cn As New SqlConnection("Data Source=MyDatabase\MyInstance;Initial Catalog=MyDatabase;Integrated Security=SSPI;")
            Dim cmd As SqlCommand = cn.CreateCommand
            cn.Open()
            If UCase(args(0)) = "DAILY" Then
                cmd.CommandText = "SELECT emailaddy FROM theusers WHERE daily=1 "
            Else
                cmd.CommandText = "SELECT emailaddy FROM theusers WHERE weekly=1""
            End If
            Dim rdr As SqlDataReader = cmd.ExecuteReader
            While rdr.Read
                Try
                    mail.To.Add(rdr("email"))
                Catch ex As Exception
                    Dim evtLog As New EventLog("Application")
                    evtLog.Source = "TheReport Execution"
                    evtLog.WriteEntry("Error during report execution (while adding main recipients): " & ex.Message & ".  " & System.Environment.CurrentDirectory, EventLogEntryType.Error)
                    evtLog.Close()
                    evtLog.Dispose()
                End Try
 
            End While
            rdr.Close()
            cn.Close()

Open in new window

0
 

Author Comment

by:synapse88
ID: 22816480
Now the only part of the code in my post above I commented out is:

                    Dim evtLog As New EventLog("Application")
                    evtLog.Source = "TheReport Execution"
                    evtLog.WriteEntry("Error during report execution (while adding main recipients): " & ex.Message & ".  " & System.Environment.CurrentDirectory, EventLogEntryType.Error)
                    evtLog.Close()
                    evtLog.Dispose()


And it still works.  So I can only assume that this code was causing the error.  Any guesses as to why?
0
 
LVL 70

Expert Comment

by:Éric Moreau
ID: 22817672
>>Any guesses as to why?

I can't see how those lines relate to the error of Crystal Reports
0
 

Author Comment

by:synapse88
ID: 22818662
Neither do I.  I have the task scheduled to run on its own tonight (as opposed to me invoking it to test which is what i've been doing) so we'll see if it runs ok...
0
 

Author Comment

by:synapse88
ID: 22820984
ok so I'm starting to think it's not just the VB code I posted above.

another unrelated Crystal Report is giving me the same error now.

"Error during report execution (main try-catch): Load report failed.Error in File C:\DOCUME~1\MyUserAccount\LOCALS~1\Temp\TheReport {5E867B68-3AB8-48C0-9305-A16AF4CED465}.rpt:
The request could not be submitted for background processing

So it seems like it has something to do with that temp folder...
Anything that can help me ensure my engine is patched would be a big help.

Thanks!
0
 
LVL 70

Expert Comment

by:Éric Moreau
ID: 22821102
1- do you have this error when the application is running from the scheduler only or do you have it also when you run the application interactively?

2- Can you check if your installation on the server has every file? Compare the CR folder of the server with the own on your dev PC (something like C:\Program Files\Common Files\Business Objects\2.7\Bin)

0
 

Author Comment

by:synapse88
ID: 22822465
1) It's currently happening when it's running from the scheduler, or invoked by me.

2) I checked the server and the files are located in:
Program Files\Common Files\Business Objects\3.0\crystalreportviewers11
(crystalreportviewers is the only folder in the 3.0 folder)
Does the 3.0 mean that SP3 is installed?

I checked on my dev pc and the files are located in:
C:\Program Files\Business Objects\common\3.5


And I don't know any easy way to compare files between the two.  There are a high number of files folders involved.

Can anyone find a link for the SP4? I have a feeling that might be needed here.
0
 
LVL 70

Accepted Solution

by:
Éric Moreau earned 500 total points
ID: 22822587
you can use WinDiff (http://www.grigsoft.com/download-windiff.htm) to compare folders
0
 
LVL 70

Expert Comment

by:Éric Moreau
ID: 23024850
I think that I deserve the points here
0
 

Expert Comment

by:fireprograms_tech
ID: 33579376
I have a customer who was having a very similiar error message  (Error in file C:\DOCUME~1\rmarianna\lisa\temp<guid>.rpt: The request could not be submitted for background processing).  What I did to resolve this was to give Network Service everything but full control to the folder in which my application was running from (also where the reports were located) and it resolved it.
0

Featured Post

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

There have always been a lot of questions related to when Crystal Reports evaluates report components (such as formulas, summaries, cross-tabs, charts, to name a few examples). Crystal Reports uses a two-pass reporting process to provide greater …
Hello everyone, Hope you find this as helpful as we did. We have on the company I work for an application built in Delphi V with Crystal Reports 8. We all know that Crystal & Delphi can be temperamental sometimes and the worst thing is, nearly…
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…

691 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question