I have this job in AX 2012 R3 CU12
private void PrintCopyAndOriginal() { CustInvoiceJour custInvoiceJourLocal; Args args = new Args(); ; select * from custInvoiceJourLocal where custInvoiceJourLocal.InvoiceId == 'INV000123'; args.record(custInvoiceJourLocal); new MenuFunction(menuitemOutputStr(SalesInvoiceCopy), MenuItemType::Output).run(args); new MenuFunction(menuitemOutputStr(SalesInvoiceOriginal), MenuItemType::Output).run(args); }
It seems that this code seriously messes up the report contracts, as parmDocumentTitle is set to "COPY" in both reports. Aditionally, one of the reports shows up without lines.
Please kindly test this code, and propose a Workaround.
*This post is locked for comments
OK.. here is one more update.
If I insert a delay in my code, the problem partially goes away. I've noticed that some fields in the report are zero, like totals. There is definately an overlapping issue.
this.PrintV2('FV453371',PrintCopyOriginal::Copy); sleep(5000); this.PrintV2('FV453371',PrintCopyOriginal::Original);
private void PrintV2(str 20 factura,PrintCopyOriginal _PrintCopyOriginal) { args args = new args(); CustInvoiceJour custInvoiceJourLocal; SRSPrintDestinationSettings printSettings; SalesInvoiceController controller = new SalesInvoiceController(); ; select * from custInvoiceJourLocal where custInvoiceJourLocal.InvoiceId == factura; args.record(custInvoiceJourLocal); args.parmEnum(_PrintCopyOriginal); controller.parmReportName(ssrsReportStr(SalesInvoice, Report)); controller.parmArgs(args); // suppress the parameter dialog controller.parmShowDialog(false); // start operation controller.startOperation(); }
Also tried this, with the same problem:
this.PrintV2('FV453371',PrintCopyOriginal::Copy); this.PrintV2('FV453371',PrintCopyOriginal::Original); private void PrintV2(str 20 factura,PrintCopyOriginal _PrintCopyOriginal) { args args = new args(); CustInvoiceJour custInvoiceJourLocal; SRSPrintDestinationSettings printSettings; SalesInvoiceController controller = new SalesInvoiceController(); ; select * from custInvoiceJourLocal where custInvoiceJourLocal.InvoiceId == factura; args.record(custInvoiceJourLocal); args.parmEnum(_PrintCopyOriginal); controller.parmReportName(ssrsReportStr(SalesInvoice, Report)); controller.parmArgs(args); // suppress the parameter dialog controller.parmShowDialog(false); // start operation controller.startOperation(); }
I'm afraid this doesn't help much. This solves the issue with parmDocumentTitle (it seems like), but I'm still getting one empty report.
Looks like making 2 calls one after another causes some kind of problem. Please try to reproduce in your environment. only the first time it worked. Then I ran again, and the problem started. One of the reports is without lines.
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,253 Super User 2024 Season 2
Martin Dráb 230,188 Most Valuable Professional
nmaenpaa 101,156