Hi
I have a codunit where I wanted to create a report as PDF and attached it to the email. It is a custom table and custom report.
can anyone suggest a mistake here?
//-----------------------------------------------
AttachmentTempBlob.CreateOutStream(OutStr);
Rep50100.GetArgs(mailRec."Customer No", mailRec."Order No", mailRec."Price Date", WorkDate(), '');
REPORT.SAVEAS(50100, '', REPORTFORMAT::Pdf, OutStr, RecRef);
AttachmentTempBlob.CreateInStream(AttachmentInStream);
EmailMessage.AddAttachment(Filename, 'PDF', AttachmentInStream);
EmailMessage.Create("Send to", Subject, 'Price Notification');
Email.Send(EmailMessage, Enum::"Email Scenario"::"Gas Price Email");
//---------------------------------------------
Please suggest the corrections
Warm regards