jhargett
6th February 2006, 17:34
I have had some success with this, so I thought I would pass it along. Especially since I got a lot of ideas from this board. This is a method I have used to integrate with Baan IVc4 without using OpenWorld or other (expensive) packages. You can actually write a Baan AFS script that can be called from the unix command line and pass data to it.

Here is the general flow of the process:

Create a simple ASCII file containing the data to modify Baan. I use a simple format that can be parsed easily by a Baan function. For instance, for sales order data, something like this:

HEAD|017605|5XA|2/01/2006
LINE|1|1001783|10
LINE|2|1001821|20

Each line can be parsed in Baan using the string.scan function.
At the Unix command line, you can now call a Baan AFS script that you have created. I wrote a small shell script to do this. What this code does is, call a Baan script with 2 arguments. The first is the path to the data file that you created in step 1, and the second is a path to a new file that Baan can use to write data to.

#/usr/bin/sh
# all BAAN and ORACLE env variables are set here
. /baan/bse/bin/baan.env

PATH=$BSE/bin:$PATH
export PATH
BASE_DIR=/apps/integration/so_integration
DATA_FILES=${BASE_DIR}/data_files

COMM_FILE=/tmp/soint_${$}.txt
echo ${COMM_FILE}
APP=$1
FILE=$2
CONO=$3
INPUT_FILE=${DATA_FILES}/${APP}/${FILE}

echo "Input file:${INPUT_FILE}"
echo "Executing Baan session"
echo "bshell6.1 -nodebug -server -set BSE_COMPNR=$CONO otdzls0201 $INPUT_FILE $COMM_FILE"
bshell6.1 -nodebug -server -set BSE_COMPNR=$CONO otdzls0201 $INPUT_FILE $COMM_FILE
echo "Baan session executed. Reading results..."
{ while read myline;do
echo $myline
done } < $COMM_FILE
rm $COMM_FILE
mv $INPUT_FILE ${DATA_FILES}/${APP}/processed/

The Baan script that is called is a 3GL program script in Baan with no form. This can be done in session ttaad2130m000 - Maintain Program Scripts. This script can contain normal AFS function calls. Make sure you create a function called main, this is the entry point for the script.
Here is a big piece of the puzzle, this main function can have arguments! Inside the main function, do this

// Baan 3GL code
string input_file(128)
string output_file(128)

| command line arguements
input_file = argv$(1)
output_file = argv$(2)

input_file is the ASCII file that you created in step 1. output_file will be a way for this script to communicate with the calling unix script.
In the this Baan script, parse the input file that you created and use AFS to insert the data in to Baan. Any data that you want to pass back to the calling unix script, you write to the output file using seq.puts()


That's it in a nutshell. More info on creating AFS scripts can be found all over this forum and there is also some info on calling Baan objects from the command line using the bshell. Really the only thing that I discovered (which may also have been published somewhere, so I probably can't even take credit for) is that you can pass arguments to the Baan script from the command line. This is the key to passing data to the function and returning what it did. Granted, it is not the easiest method in the world, but it is cheap!

Hope it helps,
Jon

anthony peiris
22nd January 2011, 17:53
Jon, What you proposed is great, keep on it..

jhargett
24th January 2011, 16:41
The original post was quite old, but thanks! We have been using this method for the past 4 years with great success. We cut reliance on 3rd party applications. It scaled surprisingly well too. We are able to thousands of transactions a month with this method. It seems that soon we will finally be upgrading to Baan LN so this will no longer be needed, but it worked well when we did.

mark_h
24th January 2011, 17:18
The original post was quite old, but thanks! We have been using this method for the past 4 years with great success. We cut reliance on 3rd party applications. It scaled surprisingly well too. We are able to thousands of transactions a month with this method. It seems that soon we will finally be upgrading to Baan LN so this will no longer be needed, but it worked well when we did.

Why won't you need it for LN? Just curious. Since this method is a good way to interface systems.

jhargett
24th January 2011, 17:23
That was said out of pure ignorance :)

Other people in my company are working on the Baan LN upgrade. I am told by them that we have other options for integrations. Perhaps they purchased a piece that allows integration. I have no idea.

günther
27th January 2011, 10:06
I've been using this method for years, too. Since I normally use "ba6.1 <object>" instead of "bshell6.1 -nodebug -server <object>", I made a simple timing measurement. And: Wow! Your way takes 0.59 seconds, my way takes about 3 seconds (on a very old test system).

Are there any other differences between these to versions to keep in mind?

Günther

dhowells
6th September 2013, 18:53
Has anyone accomplished this on Windows NT?

bhushanchanda
6th September 2013, 21:23
Hi,

Yes it can be done in Windows. You can also use VB script to update , insert, delete data in tables.