Specific SAVEASPDF question

compwizard
Member Posts: 17
Hi Guys,
I have a specific requirement that whenever a Purchase Order is posted, (the user pushes the POST button in the RTC) a PDF of that order is saved.
I'm using the brilliant SAVEASPDF which works great, but can't for the life of me figure out the syntax! ](*,)
I'm in the Object Designer > Page > Purchase Order > Design > View > Actions > F9 on P&ost
Just after
.
.
.
CODEUNIT.RUN(CODEUNIT::"Purch.-Post (Yes/No)",Rec);
REPORT.SAVEASPDF(REPORT::"Order",'C:\temp\poimage.pdf',Rec);
As I mentioned, works fine, but obviously I end up with the entire Order report. What would the C/AL need to look like to just save the PDF of that order?
Thanks in advance!
I have a specific requirement that whenever a Purchase Order is posted, (the user pushes the POST button in the RTC) a PDF of that order is saved.
I'm using the brilliant SAVEASPDF which works great, but can't for the life of me figure out the syntax! ](*,)
I'm in the Object Designer > Page > Purchase Order > Design > View > Actions > F9 on P&ost
Just after
.
.
.
CODEUNIT.RUN(CODEUNIT::"Purch.-Post (Yes/No)",Rec);
REPORT.SAVEASPDF(REPORT::"Order",'C:\temp\poimage.pdf',Rec);
As I mentioned, works fine, but obviously I end up with the entire Order report. What would the C/AL need to look like to just save the PDF of that order?
Thanks in advance!
0
Comments
-
Just a guess..
take a variable and get the document no from rec before calling the Codeunit and use that variable in saveaspdf function..0 -
Several problems with your approach...
First of all - you need to print the order before you post it, as invoicing might delete it.
Secondly - you need to set a filter on the variable passed to the report, otherwise it will print all records
Finally - if you wish to print the invoice (and not the order) you will need to find somewhere inside the posting codeunit, where the invoice is fully created and the number is known.Regards
Peter0 -
Try this
END ELSE BEGIN
PurchHeader.RESET;
PurchHeader.SETRANGE("Document Type",PurchHeader."Document Type"::Order);
PurchHeader.SETRANGE("No.","No.");
IF PurchHeader.FINDFIRST THEN;
CODEUNIT.RUN(CODEUNIT::"Purch.-Post (Yes/No)",Rec);
REPORT.SAVEASPDF(REPORT::Order,'C:\NAV\Purchase.pdf',PurchHeader);
END;0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K 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
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions