Skip to Content

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

Passing Parameter to Crystal Report

Hi Experts,

I have created and designed a Report in Crystal Report 2005. I am displaying the report in SAP B1 using Win Form . Here I want to pass 2 parameters to Report ---@FromDate and @ToDate . I have coded to pass these two parameters this way :

Dim RptDoc As New ReportDocument

Dim ParamValue As String = String.Empty

Dim crtableLogoninfos As New CrystalDecisions.Shared.TableLogOnInfos

Dim crtableLogoninfo As New CrystalDecisions.Shared.TableLogOnInfo

Dim crConnectionInfo As New CrystalDecisions.Shared.ConnectionInfo

Dim CrTables As CrystalDecisions.CrystalReports.Engine.Tables

Dim CrTable As CrystalDecisions.CrystalReports.Engine.Table


RptDoc.Load(Application.StartupPath() & "\" & ReportName & ".rpt")

RptDoc.SetParameterValue("@FromDate", "01/01/2008")

RptDoc.SetParameterValue("@ToDate", "12/31/2008")

Dim oForm_ReportViewer As Frm_ReportViewer = New Frm_ReportViewer()

oForm_ReportViewer.CRViewer.ReportSource = RptDoc

With crConnectionInfo

.ServerName = oCompany.Server '"(local)"

.DatabaseName = oCompany.CompanyDB '"SBODemoIn"

.UserID = oCompany.DbUserName

.Password = "manager@123" 'oCompany.DbPassword

End With

CrTables = RptDoc.Database.Tables

'Loop through each table in the report and apply the

'LogonInfo information

For Each CrTable In CrTables

crtableLogoninfo = CrTable.LogOnInfo

crtableLogoninfo.ConnectionInfo = crConnectionInfo



oForm_ReportViewer.Text = frmTitle

oForm_ReportViewer.WindowState = FormWindowState.Maximized


Catch Ex As Exception


End Try

But When I view the report in B1 , it throws an Exception "Report or Procedure expects parameter @FromDate which is not supplied. "

Please help me where I am making mistake , what could be the cause of this exception..

Thanks and Regards,

Pooja Singh.

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