on 06-11-2022 7:08 AM
Hi Everyone,
I did coding to send email after adding document in C#. Now I don't know how to export pdf of that document & attached it to email. I tried some solutions but didn't work. I have a PLD & Crystal reports layout ID. Using that ID , I want to export report of recently created document & attached it in to email. Please suggest me with some sample example or any alternate way.
Thanks!
Hi nansz_22,
Refer to the sample code in SAP Note 2966187.
Email part you need to implement yourself.
Kind regards,
ANKIT CHAUHAN
SAP Business One Support
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi ankit.chauhan1 ,
I'm not able to access SAP Note 2966187.
Hi nansz_22,
Below is the code from the mentioned SAP Note:
Imports CrystalDecisions.CrystalReports.Engine
Imports CrystalDecisions.Shared
Try
Dim rpt As New CrystalDecisions.CrystalReports.Engine.ReportDocument
'Database information
Dim userId As String = "Database Userid"
Dim password As String = "Database Password"
Dim serverName As String = "Database Server:port"
Dim Database As String = "Databasename"
'For HANA 32 bit B1CRHPROXY32 or HDBODBC32
'For HANA 64 bit B1CRHPROXY or HDBODBC
'For MSSQL 32/64 bit "SQL Server Native Client 11.0" or SQLNCLI11
Dim Provider As String = "B1CRHPROXY32"
'Parameters information based on the report which you use
Dim param1 As String = "C20000"
'Location of the report .rpt located in the same path of the exe,else provide full location.
rpt.Load("OCRD_HANA_Params.rpt")
rpt.DataSourceConnections.Clear()
'Connection String.Use the same structure.
Dim strConnection As String = String.Format("DRIVER={0};UID={1};PWD={2};SERVERNODE={3};DATABASE={4};", "{" + Provider + "}", userId, password, serverName, Database)
'Set Database login inputs for the reports
Dim logonProps2 As NameValuePairs2 = rpt.DataSourceConnections(0).LogonProperties
logonProps2.Set("Provider", provider)
logonProps2.Set("Connection String", strConnection)
rpt.DataSourceConnections(0).SetConnection(serverName, Database, False)
rpt.DataSourceConnections(0).SetLogon(userId, password)
'Set login info in subreports.
For Each subr As ReportDocument In rpt.Subreports
For Each conn As CrystalDecisions.Shared.IConnectionInfo In subr.DataSourceConnections
conn.SetConnection(serverName, Database, False)
conn.SetLogon(userId, password)
Next
Next
'Set Parameters
rpt.ParameterFields(0).DefaultValues.Clear()
rpt.SetParameterValue(0, param1)
'Export to disk
rpt.ExportToDisk(ExportFormatType.PortableDocFormat, Provider + "_" + Guid.NewGuid().ToString() & ".pdf")
rpt.Close()
MsgBox("Report export successfull!.Check " + Provider + "_" + Guid.NewGuid().ToString() & ".pdf")
Catch ex As Exception
'Console.WriteLine("DB_Report with Parameters")
MsgBox(ex.Message)
End Try
Kind regards,
ANKIT CHAUHAN
SAP Business One Support
nansz_22
Please open SAP note with T-Code SNOTE
and If you are not able to access SAP Note 2966187 then please you will cordinate with your basis team, i am sure they will help you for open this SAP Note.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Ok, will try & let you know
User | Count |
---|---|
78 | |
8 | |
7 | |
6 | |
6 | |
3 | |
3 | |
3 | |
2 | |
2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.