output report to pdf and attach to mail
Aldevinas Katkus
5-7-21
Operating system: Windows
I would like to attach a report when I create an email from the sales invoice.
So I modified CreateMailFromIVD()
and added a code to generate a PDF report, but it works strange:


In single user mode it attaches only my report PDF to the mail (it should attach an invoice and my report pdfs), even though I can see both PDFs are created in the tmp directory.

In client server mode it crashes the server and does not attach anything.
What is the proper way to create and attach report (not document) to the record?

windows client, linux server

My code:
...
RecordClear(RepSpec);
RepSpec.repname = "MyRn";
ReportDefaults(RepSpec,"MyRClass");
...
SetDocumentFileName(fname);

RepSpec.Media = mtPdf;
SetMedia(mtPdf);
//RunReport(RepSpec,0);
MyRn(RepSpec);//tried to call report instead of RunReport, same result
SetDocumentFilename("");
if (FileExists(fname)) then begin
RecordLinkFile(fname,0,Mailr,CurrentCompany);
Delete_File(fname);

SetDocumentFilename("");
end;

hansa.log
2021-05-06 18:28:47 (1) AK Printing Faktūros 20210111
2021-05-06 18:28:47 (1) AK PDF Error: 4133
...

2021-05-06 18:28:47 (1) AK PDF Error: 4133

2021-05-06 18:28:47 (1) AK backtrace called due to: CopyDVP with some KeyMasterArrType touchedf!=false
2021-05-06 18:28:47 (1) AK -------------------- backtrace start -------------------------
2021-05-06 18:28:47 (1) AK 0: /home/stabilus/ss/StandardERPServer64() [0x6a4838]
...
2021-05-06 18:28:47 (1) AK 22: /home/stabilus/ss/StandardERPServer64() [0x40a942]
2021-05-06 18:28:47 (1) AK 23: /lib64/libc.so.6(__libc_start_main+0xf5) [0x7f3eb669db35]
2021-05-06 18:28:47 (1) AK 24: /home/stabilus/ss/StandardERPServer64() [0x40a9e1]
2021-05-06 18:28:47 (1) AK --------------------- backtrace end --------------------------
2021-05-06 18:28:47 (1) AK
2021-05-06 18:28:47 (1) AK dump of call stack
2021-05-06 18:28:47 (1) AK Exiting to protect the database



Leave Comment
You can subscribe to notifications for this post by selecting the 'star' icon on the top right corner of the post.
Latest Posts
David Delač
Hi Piotr, The log entry:
2024-12-14 08:40:43 0.000 CallHal(IsHansaWorldCustomer) appears because the server is running with the verbosity=debug-detailed setting in its parameters.txt file. Thi...
09:43 16 Dec 2024
Brittany McGrath
Hi Vaughn, I can confirm this has been fixed now and is live in Standard ERP 2024-11-20 Version: 85556786. Thank you. ...
10:04 10 Dec 2024