slawrence
1st February 2005, 00:01
Hi

I hope I am posting into the correct place. I really know very little about coding baan and am involved in talking to a baan AFS function.

We have got the OLE automation functions working but every now and again it will hang the thread. With much investigation it would seem that at times the BW object will display a message box that is waiting for user input. Our application is running in the background as a windows service and therefore does not have a gui.

Is there any way to stop the BW object from displaying messages and just returning an error or should we be using another mechanism to talk to baan?

Can we call an AFS function directly if so is there a specific dll that has a function to call in a similar way to ParseFunctionExec or can we call the function in a more direct way (if so how do you know where the function resides)?

Lots of questions... :confused:

Thanks in advance.

lbencic
1st February 2005, 00:18
Hiyas, welcome to the boards.

The AFS, SHOULD que all messages for you, no user input required, and you can find them using the 'get.mess' api command. It will also take the default answer to any question. Any errors it should return in the error string used for each function. Questions, Messages and Errors should be handled fine without user input, that's one of the main features of the api coding.

It MAY hang if you have not handled a sub process, or, in the case of the sub process being a menu, I have found that it displays the gui menu and that can be a hang up.

So, what exactly is getting displayed, if it's a message, what is the text of it, and what baan session are you trying to call the api for?

Also, what porting set are you running under. Very old porting sets will not have decent api handling.

mark_h
1st February 2005, 00:19
This is the correct forum. What can you tell us about the back end AFS function server? Is this one developed by your company? or something from standard baan? I know on my API type function servers I can default what the answer is using stpapi.enum.answer. I am not familiar with the DDC and OLE automation programs and scripts Baan has out there.

Mark

slawrence
1st February 2005, 07:45
Thanks for replying so quickly.

The problem seems to be caused by the OleAutomation object's messages not necessarily Baan. Examples of the messages are: Licence limit reached, the logon box if you do not have saved credentials and connection lost messages.

Please excuse my ignorance but how are you calling these baan functions if you are not using the OleAutomation object?

The functions we call are all developed by ourselves and these functions call the standard baan functions to do the work as required. The main thing here is it is an unattended service so we never see the message and only see the results in the eventlog.

If this helps, here is the standard way we call the functions:


messID = "terminal1"
messErrno = "0"
messStr = "OK"
messStr = messStr.PadRight(132)
funcStr = "change"
warehouse = warehouse.PadRight(3)
Dim tmpSkid As String = ""
Dim tmpRack As String = ""
tmpSkid = tmpSkid.PadRight(30)
tmpRack = tmpRack.PadRight(30)

dllFunction = String.Format("dynamic.call (""{0}"",""{1}"",""{2}"",""{3}"",""{4}"",""{5}"",""{6}"")", messID, messErrno, messStr, funcStr, warehouse, tmpSkid, tmpRack)

baanObj.ParseExecFunction(baanFunction, dllFunction)


To be honest I would prefer to write in a C language like C# or C++ but we could not get the BW object to load in C#. Is there a way of calling the baan functions directly?

Using BaanIVc4 with B40c.73 BECS? Not sure if this helps.

Thanks again
Steven

Thanks again

mark_h
1st February 2005, 14:25
Typically all of my development is in Baan 4gl. I have done some OLE automation, but felt it was too un-reliable for my users. If you search this forum for OLE you will see that there are several ways to access Baan data. You can do direct sql statements against Baan tables, you can call Baan libraries (DLL's) and you can go directly against Baan sessions themselves using stpapi commands. I have played with all three methods. In my case I wrote a DLL to call from excel - this way I knew what parameters to pass and etc. Since my company does not own source code I could not look at the OLE DLL's that came with 4c4 - never could figure out how to call them, what they included or what method they used to update Baan. From your original post it sounded like you were calling a routine or session that was putting out a message and the OLE DLL was not handling it - I think that was were me and Lisa were going. From your last post it looks like there are messages that come back from open connection that you do not know how to handle. Maybe if you post your connection code somebody with more experience that me can make some suggestions.

On a side note - the connection lost is not something that is easily traceable. At our site we suffered the "connection lost" randomly for years. OH yeah - our servers reside in Minneapolis and I am in Kentucky. They just recently (last 6 months) upgraded our network connections between here and Minneapolis. So far this seems to solve the problem for us locally. We tried several methods of trying to track this problem down - but analysis always said everything is perfect (server, network(LAN and WAN). I want to say this points to a network bandwidth problem, but I am not sure that is always the case.

Mark