Andy..
17th May 2009, 21:18
Hi, I've setup a load of API reports to print in succession. Everything was working fine until it was requested to print multiple copies of certain reports. This has shown up various problems in the area of multi-copies.

There seems to be random results from printing 2 copies of 2 reports.

I setup the following test session for simplicity (yes its that old favourite 'print areas'):

copies=lval("2")
spool.pr.copies=copies
stpapi.set.report( "tcmcs0445m000", "rtcmcs044501000", "WINDOWS", error )
stpapi.continue.process( "tcmcs0445m000", error )
stpapi.end.session("tcmcs0445m000")

then the code repeats to represent printing the 2nd report. If you step through the code slowly in debug and wait until the first report is printed, then you USUALLY (but not always) get 2 copies of both reports.

If you run the code without debug (or hit continue in debug) you sometimes get 2 copies of the first report, sometimes only 1 copy of the first report - but NEVER any copies of the 2nd report!

The weird thing is, when you look in device history, all the prints are there with 'copies=2' set. I've tried this on BaanIVc4 sp16 and sp20 servers and they behave the same.

When you try running these reports from the BW standard session, you can print copies fine every time.

mark_h
18th May 2009, 01:43
There should be some posts in this forum on this topic. I found a couple spool variables that did not work in AFS code. I think for spool.copies I actually export it and import it into a couple of sessions. In another case I think I just run the report twice - a for loop for the number of copies.