on 05-17-2012 2:46 PM
Hi,
I am trying to print to pdf a invoice when I add it. Is there any way to do it by DIAPI?
Best Regards,
Ana Silva
Hi Ana,
I think that currently there is no native way of doing it via DI API.
I did post an idea in Idea Place about it, you can vote on it to have SAP implement it:
https://cw.sdn.sap.com/cw/ideas/6813
You can however, if it is a Crystal Report, use crystal runtime to print it.
Hope it helps.
Best regards,
Pedro Magueija
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Ana,
Dim crReport As New ReportDocument
If (File.Exists(ReportPath)) Then
crReport.Load(ReportPath)
' set parameters for your report
crReport.SetParameterValue("@DocKey", "123")
crReport.PrintOptions.PrinterName = ""
crReport.DataSourceConnections(0).SetConnection(B1Connections.diCompany.Server, B1Connections.diCompany.CompanyDB, False)
crReport.DataSourceConnections(0).SetLogon(B1Connections.diCompany.DbUserName, SqlServerPassword)
crReport.PrintToPrinter(Copies, True, StartPage, EndPage)
End If
Don't forget to include all necessary runtime dlls in the project. These are:
CrystalDecisions.CrystalReports.Engine.dll
CrystalDecisions.Shared.dll
Also, you need to have the correct version of the runtime, installed in each client machine. I think SAP B1 installs CR runtime 12.x (not 100% sure).
If you add the dlls from any other version you must install that runtime version in the client machine.
CR versions and downloads:
http://wiki.sdn.sap.com/wiki/pages/viewpage.action?pageId=56787567
I think you need the CR 2008.
Hope this helps,
Best regards,
Pedro Magueija
Hi Pedro Magueija,
Can you help me on this http://scn.sap.com/thread/3234644
awaiting for your reply.
Regards,
Bhavank
Hello Pedro,
i am always getting Falha de Logon on the database? Do you Know what can be?
Im using somthing like this:
Dim crReport As New ReportDocument
If (File.Exists("C:\FT.rpt")) Then
crReport.Load("C:\FT.rpt")
' set parameters for your report
crReport.SetParameterValue("DocKey@", "8322")
crReport.PrintOptions.PrinterName = ""
'crReport.DataSourceConnections(0).SetConnection(oCompany.Server, oCompany.CompanyDB, False)
crReport.DataSourceConnections(0).SetConnection("LB", "XXX_PRD", FALSE)
'crReport.DataSourceConnections(0).SetLogon("sa", "sasa")
crReport.VerifyDatabase() -> here i get "falha de logon"/"log on failed"
If i comment that line I get when try to print "Failed to load database information"
crReport.PrintToPrinter(1, True, 1, 1)
End If
I have the CR2008 Runtime Installed. If i try to print a blank RPT it works ok. So its the connection to the database that is failing somehow.
Thank you very much for your help.
LB
User | Count |
---|---|
108 | |
12 | |
11 | |
6 | |
5 | |
4 | |
4 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.