Hi All,
NAV 2015 here...
I made a copy of the purchase order report (10122) and put in our custom range, added it to the page 50/reports section and promoted it to Process. How do I get the document number to flow into the report automatically like it does on the original report. By that I mean, when I go to print the PO, it automatically picks up the PO number I'm on to print.
Thanks!
0
Answers
...where PurchaseHeader2 is a local variable of type Record 38
The variable is AssemblyOrderHdr2/Record/Assembly Header
The code is placed in Assembly Header - OnAfterGetRecord() and is:
AssemblyOrderHdr2 := "Assembly Header"."No.";
AssemblyOrderHdr2.setrecfilter;
report.runmodal (report::"Assembly Order Report", True, False, AssemblyOrderHdr2);
The error is:
The Record variable must belong to 900 and not to 0.
I don't see an OnPush() trigger - Only <Actionxx> - OnAction()
So I put the code into the "Print" action area - on this page it's Action 78, but it doesn't pull the correct record.
Sorry - I'm new to this and I have a number of reports I'll need to do this with, once it's working.
<Action78> - OnAction()
//DocPrint.PrintAsmHeader(Rec);
AssemblyOrderHdr2 := Rec;
AssemblyOrderHdr2.SETRECFILTER;
REPORT.RUNMODAL (REPORT::"Assembly Order Report", TRUE, FALSE, AssemblyOrderHdr2);
The code you have shown above looks fine and should work.
SalesHdr.SETRANGE("Document Type","Document Type");
SalesHdr.SETRANGE("No.","No.");
SOThankYou.SETTABLEVIEW(SalesHdr);
SOThankYou.RUNMODAL;