cancel
Showing results for 
Search instead for 
Did you mean: 

UI Loading Cystal Reports 2008 ActiveX Viewer into SAP B1

Former Member
0 Kudos

I have been looking over Code Samples, Help Forums and documentation from Business Objects for pas 5 hours. I made this work with VS2003 and CR10 but now im running VS2005 with CR2008.

Here is my code; It crashes on the bold line with the message: "Invalid cast".

The report is there and valid.

It does not even connect to a database; it has one text field in the header containing "Helloworld"

Oh and one more thing; i dont have this class CRAXDDRT. Im assuming that the class was stopped at CR11...

Imports CrystalDecisions.CrystalReports.Engine

Imports CrystalDecisions.Shared

Public Class cCRViewer

Protected oForm As SAPbouiCOM.Form

Protected oDataSources As SAPbouiCOM.UserDataSources

Protected WithEvents oCRViewer As CrystalActiveXReportViewerLib12.CrystalActiveXReportViewer

Public ocr As New ReportDocument

Public Sub New()

Dim oActiveX As SAPbouiCOM.ActiveX

Dim oItem As SAPbouiCOM.Item

Try

oForm = oApplication.Forms.Add("NewClass", SAPbouiCOM.BoFormTypes.ft_Sizable, "900201")

oDataSources = oForm.DataSources.UserDataSources

oItem = oForm.Items.Add("Viewer", SAPbouiCOM.BoFormItemTypes.it_ACTIVE_X)

oActiveX = oItem.Specific

oActiveX.ClassID = "CrystalReports12.ActiveXReportViewer.1"

oCRViewer = oActiveX.Object

ocr.Load("D:\TEST.rpt")

oCRViewer.ReportSource = ocr

oForm.Visible = True

Catch ex As Exception

End Try

End Sub

Thanks

Denis

Edited by: Denis Doiron on Sep 24, 2008 8:17 PM

Edited by: Rui Pereira on Dec 23, 2008 2:44 PM

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Please guys, I really would appreciate some help if anyone has used the New activeX Viewer from Crystal 2008.

thanks,

Denis

Former Member
0 Kudos

Denis,

I don't know what's wrong will your code, but I can tell I'm using a .NET form to show the ReportViewer.

Regards,

Vítor Vieira

Edited by: Rui Pereira on Dec 23, 2008 2:52 PM

Former Member
0 Kudos

Hi Denis Doiron ,

I also doing same thing . Did you solved your problem.

please help me out for this problem.

Thanks

Rajkumar Gupta

Edited by: Rajkumar Gupta on May 18, 2011 11:36 PM