cancel
Showing results for 
Search instead for 
Did you mean: 

How to print standart crystal report in SAPBO 8.8.1 using VB.Net code?

Former Member
0 Kudos

Hi to all, I need to know what's the way to print standart reports developed in crystal report tht SAPBO 8.8.1 includes using vb.net. I trying using the standart function printtoprinter and can't do it.

I'm using crystal reports dll's V 10.2.3600.

thanks,

Ezequiel.

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Ezequiel,

What is the request to print report by program? In what event you want to trigger it?

Thanks,

Gordon

Former Member
0 Kudos

Hi Gordon, thanks for your answer.

I'm getting the invoice report in Crystal from the default invoice report layout and save this file in .rpt file and trying to print by code calling the sub attached on itempressed event in my user form and getting this error.

Error in File C:\Users\ecomba\AppData\Local\Temp\5\ARInvoiceStandartSap {300B9A68-DF05-4D7B-8F3B-1670A4493BEE}.rpt:

Error in formula <remarkOffset>.

'Shared numberVar SectionTotalMaxHeght;

'

A number, currency amount, boolean, date, time, date-time, or string is expected here.

I referenced this dlls CrystalDecisions.CrystalReports.Engine.dll, CrystalDecisions.CrystalReports.Shared, version 10.2.3600

Private Sub DisplayThreadReportSeq()

Dim oView As New frmViewReport

Dim strReportPath As String = ""

Dim strParamName As String = ""

Try

Dim CR As New ReportDocument

CR.Load(oReport.CrstPath)

'

' Declare the parameter related objects.

'

SetReportValues(CR)

Dim crParameterDiscreteValue As ParameterDiscreteValue

Dim crParameterFieldDefinitions As ParameterFieldDefinitions

Dim crParameterFieldLocation As ParameterFieldDefinition

Dim crParameterValues As ParameterValues

'

' Get the report's parameters collection.

'

For Each oPar As cslParam In oReport.Params

crParameterFieldDefinitions = CR.DataDefinition.ParameterFields

crParameterFieldLocation = crParameterFieldDefinitions.Item(oPar.ParName)

crParameterValues = crParameterFieldLocation.CurrentValues

crParameterDiscreteValue = New CrystalDecisions.Shared.ParameterDiscreteValue

crParameterDiscreteValue.Value = oPar.Value

crParameterValues.Add(crParameterDiscreteValue)

crParameterFieldLocation.ApplyCurrentValues(crParameterValues)

Next

If pPrint Then

If oReport.Printer "" Then

CR.PrintOptions.PrinterName = oReport.Printer

End If

CR.PrintToPrinter(IIf(oReport.Copies = "", 1, oReport.Copies), False, 0, 0)

SBO_Application.StatusBar.SetText("Printed Document Successfully", SAPbouiCOM.BoMessageTime.bmt_Medium, SAPbouiCOM.BoStatusBarMessageType.smt_Success)

Else

oView.Text = pReport

oView.TopMost = True

oView.Viewer.ReportSource = CR

oView.Hide()

oView.ShowDialog()

End If

Catch ex As Exception

Util_GenErrorLog("DisplayReport", ex)

End Try

End Sub

I understand Why I get this error, because this report is printting in SAP.

Thanks,

Ezequiel.

Former Member
0 Kudos

Sorry Gordon, I trying to say that I don't understand Why report is printed ok in SAP but not from code. What do you think that is the cause of this problem?.

thanks in advance,

Ezequiel.

Former Member
0 Kudos

The report will check the current form to get certain related information. In your case, it is a user form. It will definitely be different from system form.

Former Member
0 Kudos

Hi All,

It's Possible to do?, Please help me I need solve this problem urgently.

Thanks,

Ezequiel.