Printing a NAV Report to a Server Printer - NAV 2017

robbonick
Member Posts: 40
I would like to be able to take a Printer Name, stored in a setup table and send a NAV report to there for printing. Is the only possible way to do this via Job Queue Entries? Or is there a way to do this without scheduling a Job Queue Entry.
I have tried to make use of a Single Instance Codeunit to populate a TempReportSelection record, with the Report ID and the Printer Name (Server Printer).
This doesn't seem to work when I run it, and just asks me to specify the printer (local printer) I would like to print to. I think this is because our Group Policy has the printer setup with a different name, compared to the name of the printer installed on the server (despite them being the same printer).
Ideally I just want to be able to pass the Printer Name of the server printer, and ignore the locally installed printers completely.
Here is an example of my code...
With the function in the Single Instance Codeunit code looking like this:
Any help/ideas are much appreciated.
I have tried to make use of a Single Instance Codeunit to populate a TempReportSelection record, with the Report ID and the Printer Name (Server Printer).
This doesn't seem to work when I run it, and just asks me to specify the printer (local printer) I would like to print to. I think this is because our Group Policy has the printer setup with a different name, compared to the name of the printer installed on the server (despite them being the same printer).
Ideally I just want to be able to pass the Printer Name of the server printer, and ignore the locally installed printers completely.
Here is an example of my code...
WarehouseShipmentHeader.GET(ShipmentNo); Location.GET(WarehouseShipmentHeader."Location Code"); Location.TESTFIELD("Shipment Document Printer Name"); SingleInstance.SetPrinterSelection(REPORT::"Whse. - Shipment", Location."Shipment Document Printer Name"); WarehouseShipmentHeader.SETRECFILTER; WhseShipment.USEREQUESTPAGE := FALSE; WhseShipment.SETTABLEVIEW(WarehouseShipmentHeader); WhseShipment.RUNMODAL; SingleInstance.SetPrinterSelection(REPORT::"Whse. - Shipment", '');
With the function in the Single Instance Codeunit code looking like this:
IF TmpPrinterSelection.GET(USERID,inReportID) THEN BEGIN IF inPrinterName <> '' THEN BEGIN TmpPrinterSelection."Printer Name" := inPrinterName; END ELSE TmpPrinterSelection.DELETE; END ELSE IF inPrinterName <> '' THEN BEGIN TmpPrinterSelection.INIT; TmpPrinterSelection."User ID" := USERID; TmpPrinterSelection."Report ID" := inReportID; TmpPrinterSelection."Printer Name" := inPrinterName; TmpPrinterSelection.INSERT; END;
Any help/ideas are much appreciated.
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