Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

UI Loading Cystal Reports 2008 ActiveX Viewer into SAP B1

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

Not what you were looking for? View more on this topic or Ask a question