crystal report 2011 no longer provides runtime component --Can't create Runtime Object

Sage 100 ERP

Sage 100 ERP
Welcome to the product group for Sage 100 ERP. Share discussions, questions, and best practices with other Sage 100 ERP users. Sage 100 ERP is the most comprehensive feature-rich management suite for mid-sized and smaller distributors and manufacturers.

crystal report 2011 no longer provides runtime component --Can't create Runtime Object

This question is not answered

I've found that one of the most important aspects to date in adding additional functinality to Sage 100 has been the ability to execute the printing and/or exporting Crystal Reports using a script.  Inside the script, using a line like

 

Set cr = CreateObject("CrystalRuntime.Application.11"),

 

enabled tremendous opportunities to make using the product fantastic.

 

But no more.  At least not on new installs.  

 

To my horror, I copied and pasted one of my favourites script snipits to a new client's installation and proceeded to execute the script, expecting the criticaly important report to run and export the data select to a file, ready to be imported into the system.  But no.  That was not to be.  And it wont be, at least using VBS.

 

From the SAP Community Network site:

You cannot use VBS to run Crystal Reports as you could in earlier versions. ...

 

There is no runtime included with CR 2011 ...

 

Your only option is to move to Managed Code in Visual Studio .NET 2008 and CR 2008 or VS 2010 and CR for VS 2010.

 

If you upgrade to Sage 100 2013, you'll likely be fine because the runtimes were installed previously when the workstation setup was run on users' machines.  But that no longer happens in the same way.

 

So my questions to the community and Sage are:

1) Is there a simple solution to this issue (like installing 4.50 System, LM, and GL modules only, and running workstation setup on each workstation that might run a script).

 

2 )Any chance of adding a session at Summit to address how to deal with Managed Code in Visual Studio .Net2008 and CR2008 or VS 2010 and CR for VS 2010?

 

3) Have I got this entirely wrong?

All Replies
  • HI Brian, The not so easy answer from our lead reporting engine developer:

     

    Register the Sage 100 2013 reporting component:

     

    C:\Windows\Microsoft.NET\Framework\v4.0.30319\regasm "C:\Sage\Sage 100 Standard ERP\MAS90\Home\Sage100ERP.Reporting.dll" /codebase

     

     

    Then a .vbs file with code like this can be created:

     

    Set report = CreateObject("Sage100ERP.Reporting.Report")

    report.Load("C:\Sage\Sage 100 Standard ERP\MAS90\Reports\GL_ChartOfAccounts.rpt")

    connectionString = "Driver={MAS 90 4.0 ODBC Driver};UID=all;PWD=all;Company=ABC;Directory=C:\Sage\Sage 100 Standard ERP\MAS90;Prefix=C:\Sage\Sage 100 Standard ERP\MAS90\SY\, C:\Sage\Sage 100 Standard ERP\MAS90\==\;ViewDLL=C:\Sage\Sage 100 Standard ERP\MAS90\HOME;CacheSize=4;DirtyReads=1;BurstMode=1;StripTrailingSpaces=1"

    report.SetConnection connectionString

    ' report.Preview()

    report.PrinterName = "HP on NULL"

    'Parameters: copies, collate, fromPage, toPage, reformatReportPageSettings

    report.PrintToPrinter 1, 0, 0, 0, 0

     

     

    Run the script:

     

    32 Bit O/S - wscript RunReport.vbs

     

    64 Bit O/S - C:\Windows\SysWOW64\wscript RunReport.vbs

    *(32 bit ODBC Driver)

     

    Hope this helps.  John

  • Is there any more to this?

     

    We set parameters through the crystal object like:

     

    Set cr=CreateObject("CrystalRuntime.Application.11")
    report = "Path to report"
    Set rpt=cr.OpenReport(report)
    Set cpars = rpt.ParameterFields
    Set cpar = cpars(1)
    cpar.AddCurrentValue ""&SO_SalesOrder_bus_SalesOrderNo&""

     

    Is this something that the Sage100ERP.Reporting.Report object can perform?

     

  • It would be nice to know if it can also export to Excel.

  • I uses Crystal Reports Exporter works with crystal 7 to 2008.

    www.rainforestnet.com/.../index.htm

    It provides a command line interface you can call from SYSTEM_HELP in ProvideX

  • Has there been any update on this?  I attempted to try "Crystal Reports Exporter" but that does not work for me.

    It appears the method John posted above used to work, only until PU3 came out and now it doesn't work anymore.

  • HI Dawn, Can you tell me whats not working or the error info?  Thanks John

  • I don't think the Sage100ERP.Reporting.Report takes parameters like the old Crystal Runtime.

  • Has anyone worked this out?  Our company is running 4.4 and thinking about upgrading since the tax tables, etc. appear to be losing support on 12/31/13, however we make use of a handful of VBS scripts to run Crystal Reports from multiple companies and then consolidate the outputs into a single workbook, it would be a major blow to lose this functionality...

    noted that people who are upgrading may be ok, can anyone confirm that?

  • FYI: I have managed to rewrite my VBScripts into small Vb.Net applications that function in the same manner and work with the new versions of Crystal Reports.  Again, we're using it to pass parameters to Crystal (some assigned at runtime, some static), run a report from multiple MAS companies (it loops through a logon/logoff process), export the results into Excel, and then merge everything together into one workbook.  It's a really handy tool for those of us that operate multiple companies out of Mas.  

    While it wasn't an extremely simple process, it can be done.  I'm not really a programmer so my code could probably be cleaned up/made better, however I'm happy to share the connection snippets etc. if anyone is interested.  Thanks

  • Hi Stuart,

    I would love to get a copy of some of your vb.net applications.  How can I get in touch with you?

    Sincerely,

    Brian (BRC)

  • I browsed the DLL with Visual Studio and there are a couple of Export functions available.

    public void Export(int exportFormatType, int exportDestinationType, string exportDiskFileName)

    public int ExportUsingDialog()

    I'm working this week on trying to get this to work.  I'm going to first get the export with the dialog working, then the one without the dialog.  For now, I will assume that the same export parameter values are used as in the older crystal dlls.  I would like someone to post though if they know those parameter values are different.

    I'll post back my progress when I can.

    EDIT:  Stuart - I would also be interested in the code snippets if you still have them.

  • Sorry to just now reply, it's been a very hectic couple of months.  

    The app pasted below silently calls a report, accepts a parameter from an input box, and saves an excel file for each company specified.  The magic really happens in an excel MACRO that combines and formats everything together and then emails it myself (or whoever is specified in the Macro.  You could probably do that programmatically, however this is how I set it up when using a VBscript so I just kept it like that.  

    Again, I'm not the best when it comes to code but hopefully this will help somebody.  Here are the connections snippets:

    Imports CrystalDecisions.CrystalReports.Engine

    Imports CrystalDecisions.Shared

    Imports CrystalDecisions.Web

    Imports CrystalDecisions.ReportSource

    Imports CrystalDecisions.CrystalReports

    Imports CrystalDecisions.ReportAppServer

    Imports System.IO

    Imports System.Net

    Imports System.Net.Mail

    Imports Microsoft.Office.Interop

    Public Class Form1

       Dim Rept As New ReportDocument

       Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

            Dim CheckDate

             CheckDate = CDate(InputBox("Enter Current Check Date, MM/DD/YYYY", "Enter Current Check Date"))

    ' pass the company code to the export function

           Call ExportCrystalReport("ABC", CheckDate)

           Call ExportCrystalReport("XYZ", CheckDate)

           Call ExcelSection()

       End Sub

       Private Sub ExportCrystalReport(ByVal Company As String, ByVal CheckDate As Date)

    ' connection info

           Dim CTableLogInfo As TableLogOnInfo

           Dim connCr As New ConnectionInfo()

           Dim ExportOpt As New ExportOptions()

           Dim diskOpt As New DiskFileDestinationOptions()

           Dim excelFormatOpt As New ExcelFormatOptions()

           Dim User

           Dim Comp

           Dim PW

    ' enter you credentials (I setup a user and role specifically for this purpose)

           User = "xxxx" 'use your own username

           Comp = Company  'this was passed as a variable

           PW = "xxxx"

    'call the report, this path can be anywhere I put them in the Mas folder because it's already shared

           Rept.Load("\\YOURPATH\YOURREPORT.rpt")

           connCr.ServerName = "DSN=SOTAMAS90; UID=" & User & "; PWD=" & PW & "; Company=" & Comp

           For Each CTable As Table In Rept.Database.Tables

               CTable.LogOnInfo.ConnectionInfo = connCr

               CTableLogInfo = CTable.LogOnInfo

               CTableLogInfo.ReportName = Rept.Name

               CTableLogInfo.TableName = CTable.Name

               CTable.ApplyLogOnInfo(CTableLogInfo)

           Next

    'Set parameters by name, for instance Current Check Date is the name of the parameter, the other parameters are statically assigned (they are deduction codes).  

           Rept.ParameterFields("Current Check Date").CurrentValues.AddValue(CheckDate)

           Rept.ParameterFields("401K%").CurrentValues.AddValue(16)

           Rept.ParameterFields("401KF").CurrentValues.AddValue(14)

           Rept.ParameterFields("Note Payable 1").CurrentValues.AddValue(20)

           Rept.ParameterFields("Note Payable 2").CurrentValues.AddValue(21)

           CrystalReportViewer1.ReportSource = Rept

           CrystalReportViewer1.DisplayToolbar = False

           CrystalReportViewer1.Visible = False

           ExportOpt = Rept.ExportOptions

           excelFormatOpt.ShowGridLines = True

           excelFormatOpt.ExportPageBreaksForEachPage = False

           excelFormatOpt.ConvertDateValuesToString = False

           excelFormatOpt.ExcelUseConstantColumnWidth = False

           excelFormatOpt.ExcelAreaType = 255

           ExportOpt.ExportFormatType = ExportFormatType.Excel

           ExportOpt.ExportFormatOptions = excelFormatOpt

           ExportOpt.ExportDestinationType = ExportDestinationType.DiskFile

    'Tell it where to save to, again I created a folder in the Sage directory

           diskOpt.DiskFileName = "\\YOURPATH\" + Company + ".xls"

           ExportOpt.ExportDestinationOptions = diskOpt

           Rept.Export()

           Rept.DataSourceConnections.Clear()

           Rept.Close()

       End Sub

    Private Sub ExcelSection()

    ' This section just opens an excel file and runs a Macro named CombineFiles that combines the files and then emails me the end result.  

           Dim xlApp As Excel.Application

           xlApp = New Excel.Application

           xlApp.Workbooks.Open("\\YOURPATHl\combined.xlsm")

           xlApp.Application.Visible = False

           xlApp.Run("Combined.xlsm!CombineFiles")

           xlApp.ActiveWorkbook.Save()

           xlApp.ActiveWorkbook.Close()

           xlApp.Quit()

           Me.Opacity = 0

           Me.ShowInTaskbar = False

           Me.Visible = False

           Me.Close()

       End Sub

    End Class

  • I should note that I had to install the Crystal Report developer version for MS Visual Studio that can be found on SAP's website.  

  • The following will export a crystal report to Excel.  I could not find a source for the different Export Format Types and Export Destination Types, so I determined the following parameters from trial and error.  If someone has a list of them, please post them.  Thanks.

    In the sample below, I used an export format type value of 4, and an export destination type of 1.

    Set report = CreateObject("Sage100ERP.Reporting.Report")

    report.Load("C:\TEMP\ExportTest.rpt")

    connectionString = "DSN=SOTAMAS90; UID=user; PWD=password; Directory=C:\MAS\90\500org\MAS90; Prefix=C:\MAS\90\500org\MAS90\SY\, C:\MAS\90\500org\MAS90\==\; ViewDLL=C:\MAS\90\500org\MAS90\HOME; Company=ABC; LogFile=\PVXODBC.LOG; CacheSize=4; DirtyReads=1; BurstMode=1; StripTrailingSpaces=1; SERVER=NotTheServer"

    report.SetConnection connectionString

    report.Export 4, 1, "C:\TEMP\ExportTest.xls"

  • That's great, I'm assuming that this is run through a VbScript?  We haven't actually moved to 2013 (or 2014) yet, but we really rely on some of these scripts to run different reports, so I was trying to be preemptive in getting a solution in place before upgrading.  We currently have over 20 live companies in Mas so to go through each one is time consuming and a bit of a hassle.   mentioned above that this method would not allow the passing of parameters to the report, have you looked at that at all?