VishalMistry
9th December 2010, 11:46
Hi all,
Is there any report script function which I can use to close the report from report script itself. I have tried rprt_close(), but it does not work also it does not give any error message.
Please guide.
Vishal
george7a
9th December 2010, 12:30
Can you explain why do you want to close the report from inside the report?
Normally, it should be closed from the session that printed the report.
VishalMistry
9th December 2010, 12:50
The reason is user should not be able to print the purchase requisition if certain item sub-entity data is missing. What I want is once all the data is thrown into the report, a message will be displayed and the report will be closed.
Vishal
george7a
9th December 2010, 16:12
If I understand right you have two options:
1) Edit the report so that it doesn't show the classified data in the report. Do not exit, just print all other data.
2) Don't "throw" all the data to the report, "throw" that parts that you need from with in the print session.
Hitesh Shah
14th December 2010, 17:47
just not running a report and stopping should work with stop() or end() .
sameer.don
15th December 2010, 08:03
The reason is user should not be able to print the purchase requisition if certain item sub-entity data is missing. What I want is once all the data is thrown into the report, a message will be displayed and the report will be closed.
Vishal
Do you want to prevent user from taking printout or you want stop Baan report from showing any data?
VishalMistry
16th December 2010, 07:20
Hi,
Yes. I want to prevent the user from taking print-out (even if the report is fully thrown to the device user selected). Please advice. I have tried end(), stop() and exit() but no luck.
Vishal
sameer.don
16th December 2010, 10:33
Hi,
Yes. I want to prevent the user from taking print-out (even if the report is fully thrown to the device user selected). Please advice. I have tried end(), stop() and exit() but no luck.
Vishal
You can use long brp.open( string rep_name(16), string device(14), long mode )instead of rprt_open()
Check last argument (long mode) of this function. It works as follows:
mode
0 User is not prompted to select a spooler device.
1 A window is displayed in which the user can select a spooler device.
Cancel button enables the user to cancel the operation.
2 A window is displayed in which the user can select a spooler device.
There is no option for canceling the operation.
What you can do in you code is:
....
....
....
choice.print.data:
on.choice:
if some.condition() then
brpid = brp.open("rppmmm0000000", "D", 0)
else
brpid = brp.open("rppmmm0000000", "D", 1)
endif
....
....
....
So when some.condition is TRUE, user will not be able to select device. Instead program will choose display device ("D" or any device defined at your end which can not be sent to printer) for report. User, hence, will not be able to take print-out.
When some.condition is FALSE, user will be able to select the device and can take printout.
This will
1. eliminate the need of closing the report.
2. allow the user to view and verify the report even if he can not print.
Hitesh Shah
18th December 2010, 15:01
Normally report spooling works on spool.id . Change it to 0 and export it to parent . That may stop the report .
Alternatively use pstat function to query sub-process list to bshell and then kill the processes like ttstpsplclose/ ttstpdisplay etc if existing and it's parent etc are matching .
vamsi_gujjula
13th October 2012, 22:22
hi Hitesh,
i have done the same thing , that is i have killed a report in
after.report: , because the report was running in a job and mailing an empty report with header printing.
few question are in my mind.... can please clarify them.
will there be any dangerous effect ?
and will it created any garbage files(required files) on Server.
i assume that when a report is opened there should be a format file created in the server which is feed to device which in turn prints the report.(please correct me if i am wrong.)
and yes if there is any other please let me know
Regards
Vamsi
BaanInOhio
13th October 2012, 22:51
No need to kill within the report script. Check condition in before report, setting a local boolean variable. Check the variable (or add to an existing) in the expression of every layout. Nothing will print and the report will be closed properly by the caller.
vamsi_gujjula
14th October 2012, 21:24
:) thxs, will try it out.
Hitesh Shah
15th October 2012, 18:32
hi Hitesh,
will there be any dangerous effect ?
and will it created any garbage files(required files) on Server.
i assume that when a report is opened there should be a format file created in the server which is feed to device which in turn prints the report.(please correct me if i am wrong.)
and yes if there is any other please let me know
Regards
Vamsi
When u create report , temporary file is created in tmp folder and spool record is created in device queue . Barring this nothing is affected.
But there are better ways to tackle the situations rather than this . So such method may be used as last resort if other legitimate methods are exhausted.
vamsi_gujjula
24th October 2012, 17:31
Guys,
Actually i forgot to mention .. there already exists a report script .
details layout already has a selection(suppressing some records).
and other thing that this is a easySQL query running in a job.
As BaanInOhio suggested , i tried setting a variable .... but what happens is an empty nodepad (lets assume the device is notepad) is opened .
i just want it to act as it does when no record is selected. ie. "no record with in selection"
Any more suggestion..please.
Hitesh Shah
29th October 2012, 16:57
No data within selection will come only if rprt_sends are not executed in program run and rprt_close is encountered . Data filtered in report through lattr.print = false , can not give no data within selection and empty notepad will come.