Document number flow to report
Normajm
Member Posts: 82
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!
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
-
Instead of using the RunObject property you need to run it via code, e.g. something like...
PurchaseHeader2 := Rec; PurchaseHeader2.SETRECFILTER; REPORT.RUNMODAL(REPORT::"Your New PO Report",TRUE,FALSE,PurchaseHeader2);
...where PurchaseHeader2 is a local variable of type Record 380 -
I'm trying it with an Assembly Order Report and am getting an error...
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.0 -
You need to assign the record to your variable, not the assembly no., so it should be...
AssemblyOrderHdr2 := "Assembly Header";
0 -
Thank you for the quick reply, no more error, but it isn't picking up the number...I've closed and reopened nav...

0 -
You need to add the code to the OnPush() trigger of the action on the page - not to the OnAfterGetRecord() trigger of the report. The code should be something like this...
AssemblyOrderHdr2 := Rec; AssemblyOrderHdr2.SETRECFILTER; REPORT.RUNMODAL(REPORT::"Assembly Order Report", True, False, AssemblyOrderHdr2);
0 -
Page 900/View Page Actions/F9
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);0 -
Yep, I meant OnAction() trigger - OnPush() is the old form based menubuttons
The code you have shown above looks fine and should work.0 -
No - unfortunately it doesn't - does it require a clear somewhere to clear the last entry?0
-
This is the code I found on another page that works. However, I don't know how it was created because the SalesHdr and SOThankYou objects are not in the Global variables for that page.
SalesHdr.SETRANGE("Document Type","Document Type");
SalesHdr.SETRANGE("No.","No.");
SOThankYou.SETTABLEVIEW(SalesHdr);
SOThankYou.RUNMODAL;0 -
If they are not global variables then they will be local variables0
-
C/AL Locals is greyed out. C/Al Globals/Functions/Locals/Variables - nothing there.0
-
Put your cursor on the code then look at View - Locals0
-
Thank you for that - it was there! However, when I duplicated the code on the Assembly Order page, it still didn't work - dang. However, the clue may be here. When I run the report with the working code which is a report run against the Sales Header, note it is sorted and shows a filter of Document Type of Order. When I run the Assembly Order report, it does not show that. Could that be the next step in getting this to work?0
Categories
- All Categories
- 75 General
- 75 Announcements
- 66.7K Microsoft Dynamics NAV
- 18.8K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 611 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 253 Dynamics CRM
- 103 Dynamics GP
- 6 Dynamics SL
- 1.5K Other
- 991 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 28 Design Patterns (General & Best Practices)
- Architectural Patterns
- 9 Design Patterns
- 4 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1K General Chat
- 1.6K Website
- 77 Testing
- 1.2K Download section
- 23 How Tos section
- 249 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions