User login
|
|
|
Frontpage Sponsor
|
|
|
Poll
|
Would you like to see a separate forum on Baanboard for the ION product? No 14% Yes 86% Total votes: 80 |
Baanboard at LinkedIn
|

|
|
|
 |
|

30th November 2001, 16:47
|
 |
Guru
|
|
Join Date: Sep 2001
Location: Louisville, KY, USA
Posts: 5,941
|
|
|
Baan: Baan 4C4 A&D1 -
DB: Oracle -
OS: Sun Solaris
|
Creating your own ttstpconv Sample
Below is a sample of device driver which could be used in replace of ttstpconv. The original source was posted by Kevin Brock. I modified it for my use on our system. This is just a sample of what you could do. I have another version that uses a table and tells which macro to launch for excel.
See the attached zip file for a copy of the device data.
Code:
|***************************************************************************
|* tuddcconv2 0 VRC B40C c3 dev
|***************************************************************************
|* Title : tuddcconv2 - Download file, start excel, clean up
|* Description: : This program removes downloads a report, starts excel,
|* and cleans up after itself.
|* Original Author : Kevin Brock
|* Modified by : Mark Holland
|* Date : 11/29/01
|***************************************************************************
|* Category : Utility
|* Platform : UNIX
|*
|* License for tuddcconv2
|*
|* Copyright 2001 by Mark Holland
|*
|* All Rights Reserved
|*
|* Permission to use, copy, modify, and distribute this software and its
|* documentation for any purpose and without fee is hereby granted,
|* provided that the above copyright notice appear in all copies and that
|* both that copyright notice and this permission notice appear in
|* supporting documentation.
|*
|* Mark Holland and Baanboard.com DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
|* SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|* AND FITNESS, IN NO EVENT SHALL <author> nor Baanboard.com BE LIABLE FOR ANY
|* SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|* WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE
|* OR PERFORMANCE OF THIS SOFTWARE.
|***************************************************************************
|
|*************************** DECLARATION SECTION ***************************
#pragma nowarnings
#include <bic_tt> |include tools functions
function main()
{
| This session will run the standard program conversion session
| ttstpconv using a temporary output file and the arguments
| passed in 3+ verbatim.
| Arguments are passed from Baan spooler as follows:
| 1 = Name of input (temporary) file contain dev independent report
| 2 = Name of output file
| 3 = Additional arguments (from Device data)
| 4 = Specilar parm for ttstpconv (unknown reason)
string tmp.file(1024) | Temporary file name.
string local.path(1024) | Location on client for report.
long rc | Return code.
string appl(132) | Application to start.
long app_id | Application id.
string start(1024) | Parameter for the app_start
| function which has application
| and file to use.
| Convert the report file into the temp file.
tmp.file = creat.tmp.file$( bse.tmp.dir$() )
wait.and.activate("ttstpconv", argv$(1), tmp.file, argv$(3),argv$(4))
| Set the path on the client's pc and send the file down. Let the user
| enter the path and filename to be downloaded.
local.path = strip$(spool.fileout)
| Copy file to the client.
send.report.to.client(tmp.file, strip$(local.path))
| Start the file.
appl = "C:\program files\microsoft office\office\excel.exe"
start= appl&" "&local.path
| Start the apllication
app_id = app_start(start,"","","","")
|Check status of Application.
rc = app_status(app_id)
if(rc = 0) then
message("Application start failed.")
endif
| Remove our work file
seq.unlink(tmp.file)
}
function send.report.to.client(const string src(), const string dest())
{
long err
err = server2client(src, dest, 1)
if (err) then
message("Error %d copying file to PC (may not have permission)",
err)
endif
}
Last edited by mark_h : 3rd May 2006 at 14:14.
|

22nd February 2002, 13:19
|
|
Newbie
|
|
Join Date: Oct 2001
Posts: 1
|
|
|
Conversion problem
Hi Mark,
I'd tried to install your program, but the error status isn't cleared (I used compile flag -b ottdllbw) :
When script type = 4:
tuddcconv20:
std_gen6.1 -b ottdllbw -s ptuddcconv20 -pacc B40CUS03 -qe /baanprog/bse/tmp/tmp059325143
bic6.1 -Pvariant=0 -b ottdllbw ptuddcconv2g -u -d ottstpstandard -o otuddcconv2
-f /baanprog/bse/tmp/tmp059325142 -pacc B40CUS03 -qe /baanprog/bse/tmp/tmp05932
5144
So no error message is shown, but it doesn't work. What 's wrong ?
Now we are using a device "EXCELIT" using as 4GL-program: ttstpconv and argument: ASCII:excel. This works good, but it is annoying that always a new excel application starts, also when excel is already running. Is this resolved with your script, and/or are there other advantages ?
Thanks
Thomas
|

22nd February 2002, 14:42
|
 |
Guru
|
|
Join Date: Sep 2001
Location: Louisville, KY, USA
Posts: 5,941
|
|
|
Baan: Baan 4C4 A&D1 -
DB: Oracle -
OS: Sun Solaris
|
|
Compile Option
I use the -d ottdllbw option on the compile. I am sorry to say that it will not solve the problem of launching multiple copies of excel. I have never really thought about that. I am not really sure how you stop that. Now that I think about the way that I use it I would prefer it to start multiple copies of excel. Usually (not always) when I down load to excel I kick off a macro. This way I can run the same report(different parameters) multiple times and have multiple macros running at once. See below.
This program was mainly just a sample of what you could do on your own. The way we use it hear at this site actually involves a couple of tables. One to hold the application to start and one to hold the macro that gets kicked off at the start of the app.
Examples:
table 1
report name(key) : rtisfc960001000
site (key) : lou
download filename: c:\baan\tmp\somefile.txt
macro name : somemacro.xls
macro location : f:\common\macro
table 2
site(key) : lou
appl : c:\somedir\excel.exe
I designed this for excel, but others discovered you could set up other applications. To get this to work the user selects the device PCEXCEL and puts the site key in the output file. Not elegant , but it is functional.
Mark
|

15th June 2002, 09:03
|
 |
Guru
|
|
Join Date: Jun 2002
Location: Sydney Australia
Posts: 365
|
|
|
Baan: baan4c4 -
DB: oracle 805 -
OS: AIX 4.3.3
|
Can you please tell where function server2client() can be found
or give me some idea of what is required.
(We use baan4c4)
Your help will be appreciated
Terry
|

15th June 2002, 12:35
|
 |
Senior Member
|
|
Join Date: Feb 2002
Location: Madrid - Spain
Posts: 145
|
|
|
Baan: IV c4 -
DB: Oracle 8 -
OS: Unix
|
|
server2client
It is located in ttdllbw.
you can see many threads related with its use in the forum.
Include this line in your code and then use it.
#pragma used dll ottdllbw
If you want more infromation use (in Unix), bic_info6.1 ottdllbw -eu, or use session "Print Objects by Program Script / Libraries" (ttadv2439m000)
Hope this helps.
|

15th June 2002, 15:01
|
 |
Guru
|
|
Join Date: Jun 2002
Location: Sydney Australia
Posts: 365
|
|
|
Baan: baan4c4 -
DB: oracle 805 -
OS: AIX 4.3.3
|
|
Re: server2client
Quote:
Originally posted by alejandro
It is located in ttdllbw.
you can see many threads related with its use in the forum.
Include this line in your code and then use it.
#pragma used dll ottdllbw
If you want more infromation use (in Unix), bic_info6.1 ottdllbw -eu, or use session "Print Objects by Program Script / Libraries" (ttadv2439m000)
Hope this helps.
|
|

15th June 2002, 15:22
|
 |
Guru
|
|
Join Date: Jun 2002
Location: Sydney Australia
Posts: 365
|
|
|
Baan: baan4c4 -
DB: oracle 805 -
OS: AIX 4.3.3
|
Thank you I will try it right away.
I didn't know about bic_info
Regards
Terry
|

15th June 2002, 15:38
|
 |
Guru
|
|
Join Date: Jun 2002
Location: Sydney Australia
Posts: 365
|
|
|
Baan: baan4c4 -
DB: oracle 805 -
OS: AIX 4.3.3
|
Thank you I will try it right away.
I didn't know about bic_info
Regards
Terry
|

11th December 2002, 09:48
|
|
Member
|
|
Join Date: Mar 2002
Location: Germany
Posts: 63
|
|
|
Baan: BaaN IVc4 Sp19 -
DB: Oracle 9i -
OS: HP-UX 11 / WIN
|
|
start excel with a macro
Hi mark,
i read your post on how you use excel together with a macro.
we plan to do the same, but until now i could not find the way to start excel with a special macro.
can you please tell me the syntax how to start excel with a specific file AND launch a macro after opening this file.
Thanx,
jochen
|

11th December 2002, 14:26
|
 |
Guru
|
|
Join Date: Sep 2001
Location: Louisville, KY, USA
Posts: 5,941
|
|
|
Baan: Baan 4C4 A&D1 -
DB: Oracle -
OS: Sun Solaris
|
|
Launch Excel with a Macro
To launch excel with a macro just do:
excel somepath\macrofile.xls
Please note that Excel must be in your path or you have to include the path with excel. The way I do this is the macrofile.xls contains the macro code. It uses the auto_open() subroutine to start processing. This macro knows where the data file is located and pulls it in to process it.
So I have a table that has report name and download file location and macro. My ttstpconv program looks up the report name and gets the download location. It the uses server2client to download the file to that location. Next my ttstpconv launches Excel with the macro from the table.
Mark
|

28th August 2003, 16:43
|
|
Junior Member
|
|
Join Date: Feb 2002
Posts: 5
|
|
|
Baan: IVc4 -
DB: Oracle8 -
OS: HP-UX
|
|
How can ttstpconv (or replacemnt) know the reportname?
Hi Mark!
How can Your ttstpconv replacement know about the report that it was called by?
Is there a magic variable to import?
Or do You just parse the report data for a heading (which is the least best I'd like)
I'd be interested in the technical report name, same as in Your "table 1" mentioned earlier in this thread, because in my ttstpconv replacement (or wrapper actually) I want to do some processing dependig on the report name
Thanks a lot
|

29th August 2003, 20:42
|
|
Junior Member
|
|
Join Date: Feb 2002
Posts: 5
|
|
|
Baan: IVc4 -
DB: Oracle8 -
OS: HP-UX
|
string spool.report(20)
Hrmm, hrrm,
very embarrassing! That one was a clean RTFM!
There are predefinde variables for this:
(it's even in the online-manual)
Code:
DESCRIPTION
The following predefined variables are used within the spooler functions:
long spool.date date to print
long spool.fontnumber number of font, 1=LARGE, 2=SMALL,
3=MIDDLE
long spool.id identification of spooler
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, incl left margin
long spool.time time to print
long spool.view.rtl report in bidirectional language,
true = yes, false = no
string spool.device(14) name of spooler device
string spool.fileout(100) path name of 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
Those varables are available to ttstpconv or a replacement program
Thanks anyway
|

14th November 2003, 13:17
|
 |
Junior Member
|
|
Join Date: Jul 2003
Location: Netherlands
Posts: 4
|
|
|
Baan: IV -
DB: Oracle -
OS: Win2000
|
|
I'm trying to make the clientfile read-only, but haven't succeeded sofar....
I am able to make the file in the Unix dir read-only, but what I am trying to achieve is not letting server2client overwrite the file on clientside...
Any ideas?
Greetz
__________________
One day I am gonna find peer and reset HIS connection!
|

14th November 2003, 13:48
|
|
Junior Member
|
|
Join Date: Feb 2002
Posts: 5
|
|
|
Baan: IVc4 -
DB: Oracle8 -
OS: HP-UX
|
|
Change Attrib of a file at client side
Hi Pilekes,
assume You have a bwclient, just got this idea (untested):
string dest(1024) | Temporary file name holds full client-side file path (i.e. C:\temp\foo.txt)
| do the server2client(src, dest, 0) stuff here
...
| now set dest to r/o on BW Client
app_start("ATTRIB +R " & dest ,"","","","")
Of course, errorchecking should be done on app_start, but this shoud work.
bye
|

14th November 2003, 14:20
|
|
Junior Member
|
|
Join Date: Feb 2002
Posts: 5
|
|
|
Baan: IVc4 -
DB: Oracle8 -
OS: HP-UX
|
|
Wait a minute,
what are You trying to achieve?
With the piece of code I just posted, the next server2client() will run on an error if the destination file is write-protected (as it does if it's currently opened, btw)
What You'd need additionally is probably a code that checks the returncode of server2client() and then changes the filename (or lets the user do it).
Or You should probably generate a unique filename in the form of prefix+timestamp or something in the firstplace.
bye
|
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
|
|
|
| Thread Tools |
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|