Hi, I just tested the false case, and there is no error. I think we need to check again if the Code of the Report layout is correct, and if it can be printed properly on the BC.
pageextension 50105 SalesOrderListExt extends "Purchase Order List"
{
actions
{
addafter(Post)
{
action(PrintSelectedLayout)
{
Caption = 'Print Selected Layout';
Ellipsis = true;
Image = Print;
Promoted = true;
PromotedCategory = Category8;
ApplicationArea = All;
trigger OnAction()
var
ReportLayoutSelection: Record "Report Layout Selection";
PurchHeader: Record "Purchase Header";
ZYLayouts: Label 'ZY Test Layout 01,ZY Test Layout 02';
Selection: Integer;
begin
PurchHeader.Reset();
CurrPage.SetSelectionFilter(PurchHeader);
Selection := StrMenu(ZYLayouts);
case Selection of
1:
ReportLayoutSelection.SetTempLayoutSelected('MS-1322-EMAIL_DEF');
2:
ReportLayoutSelection.SetTempLayoutSelected('1322-000001');
else
exit;
end;
Report.Run(Report::"Standard Purchase - Order", false, true, PurchHeader);
end;
}
}
}
}
Hope this helps.
Thanks.
ZHU