cancel
Showing results for 
Search instead for 
Did you mean: 

Crystal Reports for VS 2005 - ActiveX Class ID

Former Member
0 Kudos

Hi, does anyone knows the Class ID for Crystal Reports ActiveX viewer? I'm trying to create a SAP form that contains a ActiveX control to view a Crystal Report. Can anyone Help?

Thanks in advance.

Guillermo.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Guillermo,

instead to just answer your question, I would like to give you a gift !

Here the code that after many suffering days I was able to make work.

Hope you will vote my answer !

Private Sub CreateFormWithActiveX()

        Dim CP As SAPbouiCOM.FormCreationParams
        Dim fTree As SAPbouiCOM.Form
        Dim AcXTree As SAPbouiCOM.ActiveX
        Dim oItem As SAPbouiCOM.Item

        ' Set the form creation parameters
        CP = SBO_Application.CreateObject(SAPbouiCOM.BoCreatableObjectType.cot_FormCreationParams)
        CP.BorderStyle = SAPbouiCOM.BoFormBorderStyle.fbs_Sizable
        CP.FormType = "ACXTree"
        CP.UniqueID = "ACTree1"

        fTree = SBO_Application.Forms.AddEx(CP)
        fTree.Left = 10
        fTree.Top = 10
        fTree.Width = 1280
        fTree.Height = 768
        fTree.Title = "Anteprima documento Crystal"
        fTree.AutoManaged = True

        ' Add the TreeView Control to the form
        oItem = fTree.Items.Add("Tree", SAPbouiCOM.BoFormItemTypes.it_ACTIVE_X)
        oItem.Left = 1
        oItem.Top = 1
        oItem.Width = 1278
        oItem.Height = 766

        ' Create the new activeX control
        AcXTree = oItem.Specific

        CRApp = CreateObject("CrystalRuntime.Application")
        CRRep = CRApp.OpenReport("[YOUR REPORT FILE]")
        CRRep.RecordSelectionFormula = "[EVENTUALLY YOUR SELECTION FORMULA]"

        For i As Integer = 1 To CRRep.Database.Tables.Count
            Dim ConnectionInfo As CRAXDRT.ConnectionProperties
            ConnectionInfo = CRRep.Database.Tables(i).ConnectionProperties
            ConnectionInfo.Delete("Integrated Security")
            ConnectionInfo.Delete("Provider")
            ConnectionInfo.Delete("Data Source")
            ConnectionInfo.Delete("Initial Catalog")
            ConnectionInfo.Delete("User ID")
            ConnectionInfo.Delete("Password")
            ConnectionInfo.Add("Provider", "SQLOLEDB")
            ConnectionInfo.Add("Data Source", "[YOUR SQL SERCER]")
            ConnectionInfo.Add("Initial Catalog", [YOUR DATABASE NAME]")
            ConnectionInfo.Add("Integrated Security", 0)
            ConnectionInfo.Add("User ID", "sa")
            ConnectionInfo.Add("Password", "[YOUR SA PASSWORD]")
        Next

        AcXTree.ClassID = "CrystalReports12.ActiveXReportViewer.1"
        oTreeView = AcXTree.Object

        oTreeView.EnableToolbar = True
        oTreeView.EnableStopButton = True
        oTreeView.EnableSelectExpertButton = True
        oTreeView.EnableSearchControl = True
        oTreeView.EnableRefreshButton = True
        oTreeView.EnableProgressControl = True
        oTreeView.EnablePrintButton = True
        oTreeView.EnablePopupMenu = True
        oTreeView.EnableGroupTree = False
        oTreeView.DisplayGroupTree = True
        oTreeView.ReportSource = CRRep

        oTreeView.ViewReport()


        ' Make the form visible
        fTree.Visible = True

    End Sub

Former Member
0 Kudos

A Million Thanks Giuseppe!! Thank you for that precious gift!! But I couldn't make it work!! Can you tell me wich version of Crystal you have installed and wich variable type you've assigned to CRApp an CRRep variables? I hope not to bother you with my questions.

Tanks again, my suffering days are almost over!!

Former Member
0 Kudos

I have Crystal Report 2008, but this is not important.

Please add the following reference to your project.

Crystal ActiveX Report Viewer Library 12.0 (or similar)

Crystal Reports ActiveX Designer Run Time Library 11.5 (or similar)

Ciao

former_member933888
Active Participant
0 Kudos

Hi Giuseppe,

Thanks for the example.

I have problem changing the data source.

ConnectionInfo.DeleteAll()

ConnectionInfo.Add("Provider", "SQLOLEDB")

ConnectionInfo.Add("Data Source", "server") ' Server Name

ConnectionInfo.Add("Initial Catalog", "sboDemo") ' Database

ConnectionInfo.Add("Integrated Security", 0)

ConnectionInfo.Add("User ID", "sa") ' DB user

ConnectionInfo.Add("Password", "password") ' DB password

when i refresh the report from the viewer, i got error.

Failed to load database information.

Same error also when i use

CRRep.Database.LogOnServer("crdb_ado.dll", "server", "sboDemo", "sa", "password")

any idea?

I'm using ;

Crystal ActiveX Report Viewer Library 11

Crystal Reports ActiveX Designer Run Time Library 11

I

Answers (1)

Answers (1)

Former Member
0 Kudos

A Million Thanks Giuseppe!! Thank you for that precious gift!! But I couldn't make it work!! Can you tell me wich version of Crystal you have installed and wich variable type you've assigned to CRApp an CRRep variables? I hope not to bother you with my questions.

Tanks again, my suffering days are almost over!!