SujithKumar
28th November 2005, 08:59
Hi Gurus,
I am trying to use spool.open/spool.line/spool.close functions to generate reports.
I am using these function sover brp.open or rprt_send to have better control over the various parameters to be passed to the spooler device

However, what i get after calling spool.line() is an empty report (just the report window, completely blank). I am not filling spool.pr.line predefince variable (my understanding is system automatically fills this variable). If i assign some value to spool.pr.line, then its printing that value...

Can some one explain how this thing work?

Thanking in anticipation

(Sujith Kumar).

en@frrom
28th November 2005, 13:18
Hi,

Please post your code, so that we can see where it goes wrong...

SujithKumar
28th November 2005, 18:40
This is what i am trying to do
======================
This is how i open the report

label = spool.open("rwhinh945311000", "", 0)

And this is how i am sending the data to the spooler

spool.id = label
spool.device = "D"
spool.pr.copies = 3
spool.line()

and the result is an empty report.
This is the first time i am trying the spool functions. Is there anything missing?

This is the requirement
=================
1) Need to open report (without giving any option for the user to select a device). This is to print the shipping documents. We don't want the shippers to slect the devices and they always print to the same printer.
2) Also need to assign number of copies to print (like commercial inv = 3 copies, label 2 copies, delivery note = 1 copy)

Open to any ideas to get this done
Always, i love this place. Best baan resource available..!!!

Thanks a lot
(Sujith)

mark_h
28th November 2005, 20:25
If you are running standard baan sessions, then I would create a session to run them as AFS (function servers) in the background. This is what we do for receiving and issuing material. Another method would be just to change the baan sessions(assuming you have source code) to hard code the print device. You can do this a variety of ways - brp.open, rprt_open.

And if these are custom session then you also need to use spool.pr.line to set what you want each line of the report to contain. In baan 4(not sure about baan 5) spool.line() sends what is in spool.pr.line to the output device.

george7a
29th November 2005, 09:09
I have an example about how to print Areas


|spool.fileout = myfileout
spool.report = "rtcmcs044501000"
|spool.fileout = argv$(1)
spool.device = "STD"
spool.open( "", spool.device, 0)

reportnr1 = brp.open(spool.report, spool.device, 0)

if reportnr1>0 then
select * from tcmcs045
where tcmcs045._compnr = 550
selectdo
brp.ready(reportnr1)
endselect
brp.close(reportnr1)
endif

spool.close()

I hope it helps,

-George

en@frrom
29th November 2005, 10:27
You can use the brp functions or the spool functions, or a combination of both. Wehn using spool don't forget spool.close, otherwise you will not get an output. If you need more help, I suggest you send the entire relevant code..

SujithKumar
30th November 2005, 20:18
:)
Thanks for all your ideas.
I was able to do what i needed. Didnt use the spool.open/close (Still not sure how that works). Its confusing and there is not enough doucmentation on the spool functions.

Used the following structure
spool.pr.copies = 2
comm.inv = brp.open("rwhinh443001002", whinh973.dcomm, 0)
Whinh973 is a table where the device preference is stored/user

Now i use brp.ready(comm.inv)

Thanks
(Sujith)

NPRao
30th November 2005, 20:35
Whinh973 is a table where the device preference is stored/user
just curious, do you have the device preference template - ttams1140m000, (which stores similar information) in your BaaN version? why recreate the similar table/functionality?

SujithKumar
1st December 2005, 17:08
Rao,

We do use the standard device preferences.
This is more than that. In this session we store 4 printers devices, 1) for Label, 2) Commercial Invoice 3) for Delivery Note 5) Other Shipping Documents

The program reads these values and direct various shipping documents to the devices accordingly

(Sujith)

KaasKarthik
23rd September 2020, 14:33
Hello sir,i want to run report in backround baan,before i user run the report,for calculating page number.i wan't the code to access the report in program script.

bdittmar
23rd September 2020, 14:45
Hello,

Spooling overview and synopsis
Overview
Use these functions to handle printer devices and printing.

Synopsis
long spool.buf() ( const string buffer(.), long length )
void spool.close() ( )
long spool.line() ( )
long spool.open() ( string reportname(15), string device(14), long mode )
boolean spool.restore.variables() ( [long brp.id] )

Predefined variables
The following predefined variables are available for use with the spooler functions:

long spool.date Date to print.
long spool.fontnumber Font number:

1 LARGE
2 SMALL
3 MIDDLE

long spool.id Spooler ID.
long spool.left.mrg Left margin.
long spool.pr.copies Number of copies.
long spool.pg.length Length of page.
long spool.pg.width Width of page, including left margin.
long spool.time Time to print.
long spool.view.rtl Specifies whether the report is in a bidirectional language:

true bidirectional language

false non-bidirectional language

string spool.device(14) Name of spooler device.
string spool.fileout(100) Path name for spooler output file.
string spool.paper.type(6) Type of paper.
string spool.pr.line(300) Line to print.
string spool.report(20) Report to be printed.
string spool.main.report(20) The name of the report that must be used as main report.
long spool.crn Print to Production Reporting Services (if not 0).
boolean spool.docman Print to a Document Output Management device.
long spool.orientation Orientation of the paper type:

1 Portrait
2 Landscape

long spool.pr.from Print from page.
long spool.pr.to Print to page.
long spool.preview Show a preview of the print:

1 yes
2 no

boolean spool.ssrs Print to Microsoft SQL Server for Reporting Services.
long spool.xml Write an intermediate file in XML format (if not 0).



Regards

KaasKarthik
24th September 2020, 06:56
Thank you sir,for your reply....................