sitarammani
29th March 2002, 18:07
The attached script e.awk will provide an easy way for your
Baan report to MS Excel.
Benefits:
With full respects to all who suggested the direct excel.exe
solution, this script will save the user from doing the
operations required to convert delimited text to columns.
1> You will need AWK MS-DOS version to use this.
(I have selected the MS dos Route, I leave it to the reader to
try out the UNIX route).
AWK.exe ideally should reside in c:\windows\command
(windows will easily find it).
The version of awk suggested consists of just one file awk.exe.
Source[s] to obtain get awk.exe for MS-DOS:
Check the sources listed below
Why AWK?
The distribution suggested has a very small footprint.
It is lightweight. Only one exe file. ..........................(A)
If your company policy prevents you from using awk.exe
from the the net, simply translate the logic to WSH to
use it with wscript.exe or cscript.exe
2> You will need to define a device in Baan.
You may be familiar, but described below. .......................(B)
3> You will need to create excel.bat in
c:\windows\ ( not c:\windows\command) directory
This should contain just one line as follows
awk -f c:\baan\e.awk %1
(Modify the path of e.awk if you have to)
4> You should agree to the script e.awk removing all
occurance of ',' in the Baan report's character, numeric
and any other fields.
5> You should agree to the script e.awk deleting
BaanReport.txt (file coming from Baan) and accept to view
the newly created file BaanReport.csv in MS Excel.
So also if BaanReport.csv exists it will be overwritten.
6> You will ensure CSV files are associated with MS Excel
in Windows. (most likely they are)
7> Download the script e.awk and let it reside in
c:\baan (suitably change the path if baan directory is different)
(A)................................... Source you can get awk.exe free
http://cm.bell-labs.com/who/bwk/awk95.exe
ftp://ftp.oxy.edu/public/mawk113exe.zip
I prefer the distribution from
http://cm.bell-labs.com/who/bwk/awk95.exe
This accepts long file names.
copy awk95 exe c:\windows\command\awk.exe
Do retain a copy awk95.exe
(in case windows is reloaded it will be handy)
Please Maintain a backup of :
e.awk
excel.bat
along with awk95.exe
If you need awk documentation, it is available in UNIX Man.
For MS-DOS version search for MAWK.DOC in the net, others
also available.
.......................................................................................
(B)................................... Define Device using Maintain Devices Session
Device : MSEXCEL
Description : MS Office Excel
Device Type : Rewrite File
....
....
..........Skip these fields......
....
....
4GL Program : ottstpconv
Argument : ascii:c:\windows\excel.bat %s
path :/tmp/
change allowed :YES
Page Length :72
......................................
Ensure the path mentioned in excel.bat is correct. Change the path in excel.bat if you need to.
Baan report to MS Excel.
Benefits:
With full respects to all who suggested the direct excel.exe
solution, this script will save the user from doing the
operations required to convert delimited text to columns.
1> You will need AWK MS-DOS version to use this.
(I have selected the MS dos Route, I leave it to the reader to
try out the UNIX route).
AWK.exe ideally should reside in c:\windows\command
(windows will easily find it).
The version of awk suggested consists of just one file awk.exe.
Source[s] to obtain get awk.exe for MS-DOS:
Check the sources listed below
Why AWK?
The distribution suggested has a very small footprint.
It is lightweight. Only one exe file. ..........................(A)
If your company policy prevents you from using awk.exe
from the the net, simply translate the logic to WSH to
use it with wscript.exe or cscript.exe
2> You will need to define a device in Baan.
You may be familiar, but described below. .......................(B)
3> You will need to create excel.bat in
c:\windows\ ( not c:\windows\command) directory
This should contain just one line as follows
awk -f c:\baan\e.awk %1
(Modify the path of e.awk if you have to)
4> You should agree to the script e.awk removing all
occurance of ',' in the Baan report's character, numeric
and any other fields.
5> You should agree to the script e.awk deleting
BaanReport.txt (file coming from Baan) and accept to view
the newly created file BaanReport.csv in MS Excel.
So also if BaanReport.csv exists it will be overwritten.
6> You will ensure CSV files are associated with MS Excel
in Windows. (most likely they are)
7> Download the script e.awk and let it reside in
c:\baan (suitably change the path if baan directory is different)
(A)................................... Source you can get awk.exe free
http://cm.bell-labs.com/who/bwk/awk95.exe
ftp://ftp.oxy.edu/public/mawk113exe.zip
I prefer the distribution from
http://cm.bell-labs.com/who/bwk/awk95.exe
This accepts long file names.
copy awk95 exe c:\windows\command\awk.exe
Do retain a copy awk95.exe
(in case windows is reloaded it will be handy)
Please Maintain a backup of :
e.awk
excel.bat
along with awk95.exe
If you need awk documentation, it is available in UNIX Man.
For MS-DOS version search for MAWK.DOC in the net, others
also available.
.......................................................................................
(B)................................... Define Device using Maintain Devices Session
Device : MSEXCEL
Description : MS Office Excel
Device Type : Rewrite File
....
....
..........Skip these fields......
....
....
4GL Program : ottstpconv
Argument : ascii:c:\windows\excel.bat %s
path :/tmp/
change allowed :YES
Page Length :72
......................................
Ensure the path mentioned in excel.bat is correct. Change the path in excel.bat if you need to.