EinTerraner
Technical User
good... whatever your timezone is 
I've no Idea what i did wrong. but since 15 Years it worked well for me.
1st Step i prepare two Cursors named "DRU_KOPF" and "DRU_DATA".
DRU_KOPF has only one record and it contains directives and basic informations for my report like report Title-, Header- and Footer-sections.
DRU_DATA is filled with all data used in several Detail-sections. Also some boolean fields for the "Print when"-clause
But now there is a strange beahvior and a difference between the PREVIEW and TO PRINTER
with PREVIEW it works well and i'll get the correct amount of pages like this snippet to see

but the TO PRINTER output generates something between 50 and 80 pages and they look like this snippet

it only prints the 1st Line from my DRU_DATA file cpl hundred times.
the ridiculous part now:
if i add a line like tzhe BROWSE
or a INKEY(1)
The TO PRINTER output is correct

IT DRIVES ME CRAZY
I've no Idea what i did wrong. but since 15 Years it worked well for me.
1st Step i prepare two Cursors named "DRU_KOPF" and "DRU_DATA".
DRU_KOPF has only one record and it contains directives and basic informations for my report like report Title-, Header- and Footer-sections.
DRU_DATA is filled with all data used in several Detail-sections. Also some boolean fields for the "Print when"-clause
But now there is a strange beahvior and a difference between the PREVIEW and TO PRINTER
Code:
...
&&creating DRU_DATA
SELECT * FROM (SourceData) INTO CURSOR DRU_DATA WHERE ...
SELECT DRU_DATA
SELETE TAG ALL
ALTER TABLE DRU_DATA ADD ..... && add some directives for the report
....
&&creating ReportFile Lc_Dest
Lc_Dest = <function for the desired FRX-File>
&&select printername Lc_Port
SET PRINTER TO NAME (Lc_Port)
select DRU_DATA
go top
if Tf_View && preview this document
SET CLASSLIB TO (ThisForm.ClassLibrary) ADDITIVE
Lo_Form = NEWOBJECT("_defobject_form")
WITH Lo_Form
.TitleBar = 1
.BorderStyle = 3
.height = SYSMETRIC(22)
.width = (.Height/6)*5
.autocenter = .t.
.name = GETWORDNUM(ThisForm.Name, 1, "ß")+"_"+This.Name
.alwaysontop = .t.
.closable = .T.
.ControlBox = .T.
.MaxButton = .f.
.MinButton = .f.
.Themes = .t.
.Caption = ALLTRIM(Lc_Name)
.Show(1)
SELECT Dru_Data
REPORT FORM (Lc_Dest) PREVIEW WINDOW (.Name)
.WindowState = 0
.release()
ENDWITH
else && print this document
IF ReportNoPrompt
REPORT FORM (Lc_Dest) TO PRINTER NOCONSOLE NOOPTIMIZE
ELSE
REPORT FORM (Lc_Dest) TO PRINTER PROMPT NOCONSOLE
ENDIF
endif
with PREVIEW it works well and i'll get the correct amount of pages like this snippet to see

but the TO PRINTER output generates something between 50 and 80 pages and they look like this snippet

it only prints the 1st Line from my DRU_DATA file cpl hundred times.
the ridiculous part now:
if i add a line like tzhe BROWSE
Code:
SET ORDER TO DRU_BELG IN Dru_Data
GO TOP IN Dru_Data
SELECT (Dru_Data
BROWSE LAST FIELDS DISLINE, ARTKURZ, ARTMENG, ARTVKPR, ARTGSUM
Code:
SET ORDER TO DRU_BELG IN Dru_Data
GO TOP IN Dru_Data)
SELECT Dru_Data
=INKEY(1)

IT DRIVES ME CRAZY