jmggrf
6th September 2013, 16:18
Hi Baanboard,
Is there a way to prevent ttstpsplopen: Select Device form activationg when running a print session? A null printer?
Regards
Baan IVc4 Win8

mark_h
6th September 2013, 16:39
Is this your source? You can use brp.open instead of rprt_open(). Maybe more info on what you are trying will allow someone to make other solutions.

Ankita Patel
7th September 2013, 06:41
Hi Baanboard,
Is there a way to prevent ttstpsplopen: Select Device form activationg when running a print session? A null printer?
Regards
Baan IVc4 Win8

Hi,

Syntax
long brp.open( string rep_name(16), string device(14), long mode )

Description
This activates a specified report and opens a specified spooler device (if it is not already open). Several reports can be active simultaneously. In a 4GL script, the name of the current report is stored in the predefined variable spool.report. This variable is available in the on.choice subsection of a choice.print.data section.

Arguments
rep_name
The name of the report. Do not include a language code. The language of the user is automatically used.

device
The code of the device on which the report must be printed. This code must be defined in the data dictionary. If you specify an empty string here, you can use the mode argument to display a window in which the user can select the required device.

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. A
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.


Return values
>0 an ID for the activated report
0 report could not be activated
-1 spooler could not be opened

Hope this will work for you

stegro
17th September 2013, 10:22
I use this thread for my question regarding ttstpsplopen.
While executing a script a report should be send via email to a specified range of users, for example some items are found as a sideproduct and the responsible employees should be informed.
I thought of a solution like creating the report but suppressing the ttstpsplopen dialog but filling its fields with the information device = Email, path = employee@abc.com... and sending it.

I found that the brp... commands should do this, but I have difficulties with it and I can't see how to set the path?!

First of all: do you think this is a goog way to achieve the requirement? If yes, how to set the path?

choice.print.data:
on.choice:

brp_id1 = brp.open("rreportname","Email",1)
-->how to set path????

if brp_id1 > 1 then
rprt_send()
brp.close(brp_id1)
else
choice.again()
endif

mark_h
17th September 2013, 14:47
You can search this forum for email and find several ways to accomplish this. In our case we usually write some kind of temp file - either by directly writing a file or by running a report to ASCIF and writing a temp file. Then once we have a file we just run some UNIX commands to send the email. Your profile shows windows and since we use UNIX as our OS the code I have would not help you at all. Your best bet is to search for email on this forum.

bhushanchanda
17th September 2013, 16:59
Hi,

I don't use your method for emailing. Well, I believe there are different ways and better ways to do that.

1. Your profile show's you have SQL as your database, so what you can do is, you can create a temp file like Mark said and use SQL Mail to mail it. For that, you can create the temp file at runtime, and you can create a .sql file with the SQL mail query and add the recipient address as the mail address you want. Now, you can run a bat file which will have sqlcmd command toexecute this .sql file.

Now, when you print a report, it will be emailed in following way:-

Create tmp file -> Create .sql file -> run a bat file to execute .sql file -> Email Sent.

2. The second way is, you can use Blat application as mailing application. Check this Thread (http://www.baanboard.com/baanboard/showthread.php?t=64313).

3. Again, if you have not updated your profile and if you are on LN, you can use Emessage Connector (http://www.baanboard.com/programmers_manual_baanerp_help_emessage_connector_examples) functionality

I use 1s't way to do it. Its simpler and yeah, it has 99% success rate. :)

stegro
17th September 2013, 20:42
First of all thanks for your answers! I will check all shown solutions one by one.

And I have to correct my profile, in fact we have LN in combination with unix, so I could use some mailx, but I do not really know how to do this -

@mark_h: could you post your solution?

Thanks again, I will give feedback as soon as I face the first questions/problems ;-)

mark_h
17th September 2013, 21:56
Well here is the code that sends out email - you can see where we use uuencode on the temp file and then send to an email a customer.


function send.out.email()
{
string cmd(1000)
string email.file.name(256) | email.lst
long email.fp
string email.ident(1)
string email.addr(100)

email.file.name = in.dir & "email.lst"
if not open.file(email.fp, email.file.name, FTYPE.READ) then
return
endif


rc = seq.gets(buf, 1024, email.fp)

| 20081106 encode the file out side the loop - if not each each successive
cmd = "uuencode " & err.file.name & " Errors.txt >>" & temp.file
rc = shell(cmd, SHELL_NO_OUTPUT)

while not seq.eof(email.fp)
email.ident = buf(1;1)
email.addr = buf(3)
| 20081106 added the [ >> " & temp.file & ] (without brackets) to get encoded file at the end of the body. Added "& "<" & temp.file"
| to send the body and error file.
| cmd = "uuencode " & err.file.name & " Errors.txt >> temp.file"
| rc = shell(cmd, SHELL_NO_OUTPUT)
cmd = "mailx -s 'PeopleSoft/Baan Employee Errors (Automated Email)' " &
strip$(email.addr) & "<" & temp.file
| cmd = "uuencode " &
| err.file.name & " Errors.txt >> " & temp.file & " | mailx -s 'PeopleSoft/Baan Employee Errors (Automated Email)' " &
| strip$(email.addr) & "<" & temp.file
if email.ident = "A" then
rc = shell(cmd, SHELL_NO_OUTPUT)
else
if email.ident = "E" and err.flag then
rc = shell(cmd, SHELL_NO_OUTPUT)
endif
endif
rc = seq.gets(buf, 1024, email.fp)
endwhile
rc = seq.close(email.fp)

}

stegro
20th September 2013, 10:05
Thank you Mark, I chose this kind of soulution now. The file already works, now the sending is the next step...