Go Back > Blogs > roylansink's blog

User login

Frontpage Sponsor


Is it good to change the Technology per business or changing Business per Technology?
Change Technology per Business
Change Business according to Technology
It Depends
Never change Business
Total votes: 14

Baanboard at LinkedIn

Reference Content

spool report to second device
By roylansink at 7 Apr 2020 - 14:29

Hi All, 

 I'm trying to print a report to a second device. The idea is that with the print, the report is stored to a folder as well. 

The following code is used for testing purpose, but when I run the report, I get a blank notepad file. What am I doing wrong?  


|Save original values
org.spool = =
org.fileout = spool.fileout

|Open extra spooler and print report ="rtcmcs041011000","NOTEPAD",0)          

|fill predefined vallues with original values = org.spool =  


No votes yet

by bhushanchanda on April 7, 2020 - 4:42pm
bhushanchanda's picture
Moved the blog post to a thread in Tools Dev forum.

Can you please post a screenshot of your report layout? i.e. What sections do you have on your original report - e.g Header, Detail...

The way you are doing will not work because the spool is reserved for the first spool ID already.

You might need to call internal report script functions to trick the spooler.

e.g. r.1.s.header() for printing Header.

But first, it would be good to understand your report design.

by bhushanchanda on April 7, 2020 - 5:28pm
bhushanchanda's picture
You can try something like this - Tried this on session tcmcs0401m000

You might need to handle special report fields in your report script. But it works as far as creating a copy.


extern long
extern long
extern string
extern string org.fileout(100)

extern domain tcbool header.printed

before.program: = ="rtc040101000","NOTEPAD",0)
   header.printed = false

detail.1: =
   if not header.printed then
      header.printed = true

   r.1.s.detail() =

after.program: =
   spool.close() =

And if your first device is also notepad or something which is writing a text/ascii file, you can simply use this code to copy the file to your destined location -

   long ret
   string copied_file_path(100)

   copied_file_path = "E:\my_dir\copied_file.txt"
   ret =,copied_file_path)

All times are GMT +2. The time now is 10:36.

©2001-2021 - -