psuryava
13th February 2013, 12:33
Hello,

Please find below code

select tcsil999.*
from tcsil999
where tcsil999._index1 inrange {:cuno.f} and {:cuno.t}
selectdo
spool.fileout = creat.tmp.file$(bse.tmp.dir$())
stpapi.put.field( "tdind0430m000", "cuno.f", tcsil999.cuno )
stpapi.put.field( "tdind0430m000", "cuno.t", tcsil999.cuno )
stpapi.put.field( "tdind0430m000", "ddat.t", str$(date.num()))
stpapi.set.report( "tdind0430m000", "rtdind043011000", "ASCIT", error )
stpapi.continue.process( "tdind0430m000", error )
stpapi.end.session( "tdind0430m000" , error )
pending.so.file.name = spool.fileout
send.mail.to.customer()
selectempty
endselect

I want to send report output in 'spool.fileout' to customer as mail attachment.
For first record I am getting data in spool.fileout file, but for next records there is no data in spool.fileout. size of spool.fileout is always zero.

Please help.

Thanks,
psuryava

mark_h
13th February 2013, 15:56
Well this is a bug I ran into in my 4c4 version and the same issue occurred with spool.pr.copies. I think what you will find is even though you set spool.fileout to a new file name it is running to the original spool.fileout file name. If you run it for something like two customers you should see both of them in the original spool.fileout file. I got around this spool.pr.copies by importing it each time it a custom script I was calling. Not sure if the same is possible. I did not have to worry about spool.fileout - because if it went to a file in this process, it was not being printed and could be discarded. I would first confirm this is happening - make sure all the output is going to the first spool.fileout file name.

I tried a lot of things to get around this issue, but one thing I do not recall trying was calling seq.close or seq.unlink on spool.fileout. Right now I can't think of anything else to clear spool.fileout. I will look a little more to see if I did something another place, but I do not recall a situation where I needed to worry about spool.fileout.

LisaBencic
29th March 2013, 21:15
Have you tried:

stpapi.put.field("sessioncode", "spool.fileout", "filename")

same for any spool.*

mark_h
31st March 2013, 03:30
When I first ran into the problem I tried that and a bunch of other things. Once I got the fix I never re-investigated it with each SP we installed. Never hurts to try again. As a matter of fact I think I had the same problem with calling the RMC label program. I believe I got around it just using a loop and counter. :)