CC report auf 2 verschied. Druckern gleichzeitig ausgeben

17. November 2010 07:53

Hallo,

ist es möglich einen report auf 2 verschiedenen Druckern gleichzeitig auszugeben, einmal am Standarddrucker des Clients (so ist das jetzt eingestellt) und zusätzlich noch auf einem PDF-Drucker?

Wir wollen eine PDF-Kopie zusätzlich ablegen, jetzt löse ich das so, indem ich den report kopiere und im Original-Report mit folgendem Aufruf den Druck des kopierten reports starte, der dann aufs PDF läuft (ist dann im Menüpunkt IT-Verwaltung/Allgemeine Einrichtung/Druckerauswahlen fixiert):

Report - OnPostReport()
REPORT.RUN (XXX, FALSE, TRUE);

geht doch sicher eleganter, oder? :oops:

Danke für Hinweise.

Re: CC report auf 2 verschied. Druckern gleichzeitig ausgeb

17. November 2010 22:59

Ich habe folgendes gefunden, wenn es nur so geht, dann vergesst es, dann kommen halt ein paar mehr reports rein...

Quote MIBUSO.com:
In standard Navision a report can be assigned to a Printer, and that´s it. If you want to print to different printers with one Report without getting a printer selection window, you´ll have a problem with Navision.

Maybe the follwing may appear trivial to some of you, but maybe not for all. What I wanted, is a code like the following:

DefPrintMode.SetPrinter('My_Printer');
REPORT.RUN(Report::MyReport,FALSE,FALSE,Record);

DefPrintMode.SetPrinter('My_Other_Printer');
REPORT.RUN(Report::MyReport,FALSE,FALSE,Record);

and it´s possible. What you need is a modification of one of the functions within CU1. The german name of that function is "Drucker holen", which means "Get printer" (2nd function within CU1). What you although need is a Single instance CU, which you can easily create by setting the single instance property of that CU to YES. Such a SI-CU gives you a way, to pass a value from any object to any other object without using a table. By that its more global than a Global, but still local to the running client.

Here are the 2 functions within that SI-CU:

// SelectedPrinter is a Global to that CU!

SetPrinter(PrinterName : Code[30])
SelectedPrinter := PrinterName;

GetPrinter() Drucker : Code[30]
tmp_PrinterName := SelectedPrinter;
CLEAR(SelectedPrinter);
EXIT(tmp_PrinterName);

The second function clears the value set by SetPrinter, when it´s retrieved. This is only, that if a printer for a report is defined, it will be valid only once -> see CU 1 code below.

The basic idea for the CU1 function is this:

// Get printer - if defined -
// from Sincgle instance CU, and delete within there

DefinedPrinter := DefPrinter.GetPrinter();

IF DefinedPrinter <> '' THEN BEGIN
// If a Printer was specified, use it, otherwise use standard method ...
... very similar to standard code, but using "DefinedPrinter"
instead of lookup to printer def. table
END ELSE BEGIN
... standard code
getting printer from printer def. table
END;

The standard code of this CU1 function does a pretty trivial job - it looks for the defined Printer within table 78 and then loops through the table with all available printers on that workstation (table 2000000039). If it can find the defined printer, it returns its ID, otherwise it returns a blank, and the report will use the system printer.

By the way: Modifications to that loop can be interesting, if you got different printers on different WS for the same job, which do habe the same base name, like BILL_IT, BILL_WH ...

Where we had 4 reports with the same layout for 4 printer assignments in the past, we now got only one left.

Pidi

_________________
Michael Peters
Bos Fod GmbH Düsseldorf
+49 2132 139-0