Hello dear developers!
I have the following problem when generating a report and sending it.
I have created a job queue with my own codeunit.
This is about the Registered Delivery Reminders (table 5005272 - Issued Deliv. Reminder Header)
I select the records I need and get the email address from the vendor (table 23 Vendor).
The following code snippet gives me a headache:
RecRef.GetTable(IssuedDeliveryReminderRec);
TmpBlob.CreateOutStream(OutStr);
if (Report.SaveAs(5005273, '', Format::Pdf, OutStr, RecRef)) then begin
TmpBlob.CreateInStream(InStr);
TxtB64 := Cnv64.ToBase64(InStr, true);
EmailMsg.Create('mailadress@example.de', 'DeliveryReminder' + IssuedDeliveryReminderRec.Name, DescriptionFromIssuedDeliveryLine, false);
EmailMsg.AddAttachment('ReminderMail_' + IssuedDelNo + '' + IssuedDeliveryReminderRec.Name + '.pdf', 'application/pdf', TxtB64);
Email.Send(EmailMsg, Enum::"Email Scenario"::"Delivery Reminder");
end;
Sending the email to the different vendors works.
The error is that only one report is generated.
However, only one report with one header is generated. All the lines of the selected reports are displayed all together in the rows.
Example:
If I have selected 3 providers, a header is created and all lines of all 3 vendors end up in one report.
I have assumed that the report is generated and sent individually. To be sure I have cleared the used fields:
RecRef.Reset();
Clear(OutStr);
Clear(TxtB64);
Clear(InStr);
Has anyone ever tried something like this and could help me?
Thank you!
Faith
Great.
That was not the reason.
It was the
RecRef.GetTable(IssuedDeliveryReminderRec);
and the following was missing :
RecRef.SetRecFilter();
In my execution I also set the reset position incorrectly. These two points helped that my code runs error free
Please provide the Vendor filter and send that Vendor records in your Saveas function, you also need to run all your code under your Vendor Repeat...until method.
Thanks.
Sohail Ahmed
2,655
Mansi Soni
1,574
YUN ZHU
1,453
Super User 2025 Season 1