Al Smith
18th September 2002, 00:02
Hi,
We have an application whereas our field techs can close a service order over the wireless web using their cell phone.
I am trying to get all of the code for this off of the Baan box and onto our www server. I have everything working except the function to write repair text.

Below is one method I'm exploring.
The tables are being updated but revert back when quitting.
the bw error "A not terminated transaction is aborted" comes up when quitting.
I suspect I need to figure out how to commit the transaction via OLE.

Any ideas will be greatly appreciated.
Thanks,
Al.

(I'm also experimenting with an AFS using tttxt1100m000, etc.)

Sub Main()

Set BaanObj = CreateObject("Baan4.Application")
Query = "select tssma301.* from tssma301 where tssma301.orno =214269"
query_id = GetQid(Query)
BaanObj.ParseExecFunction "ottstp_textdll", "text.write(" & Chr(34) & "tssma301.tjob" & Chr(34) & "," & Chr(34) & "2" & Chr(34) & "," & Chr(34) & "Service order" & Chr(34) & "," & Chr(34) & "Edited Text" & Chr(34) & "," & Chr(34) & "214269" & Chr(34) & "," & Chr(34) & "Edited" & Chr(34) & "," & Chr(34) & "text" & Chr(34) & "," & Chr(34) & "text" & Chr(34) & "," & Chr(34) & "/home/web2baan/fixtext.214269" & Chr(34) & ")"
Debug.Print BaanObj.ReturnValue ' Number of lines written
QueryEnd

' ------------------ Code below for Development only ------------------

' **** Check that text number was written to tssma301.tjob ****

Query = "select tssma301.tjob from tssma301 where tssma301.orno =214269"
BaanObj.ParseExecFunction "ottdllsql_query", "olesql_parse(" & Chr(34) & Query & Chr(34) & ")"
txtno = GetData("tssma301.tjob")
Debug.Print txtno
QueryEnd

' **** Check that data was written to table tttxt001 ****

Query = "select * from tttxt001 where tttxt001.ctxt=" & txtno
query_id = GetQid(Query)
BaanObj.ParseExecFunction "ottdllsql_query", "olesql_fetch(" & query_id & ")"
BaanData = GetData("tttxt001.txtg")
Debug.Print BaanData
BaanData = GetData("tttxt001.opwd")
Debug.Print BaanData
QueryEnd

' **** Check that data was written to table tttxt002 ****

Query = "select * from tttxt002 where tttxt002.ctxt=" & txtno
query_id = GetQid(Query)
BaanObj.ParseExecFunction "ottdllsql_query", "olesql_fetch(" & query_id & ")"
BaanData = GetData("tttxt002.kwd1")
Debug.Print BaanData
BaanData = GetData("tttxt002.kwd2")
Debug.Print BaanData
BaanData = GetData("tttxt002.kwd3")
Debug.Print BaanData
BaanData = GetData("tttxt002.kwd4")
Debug.Print BaanData
BaanData = GetData("tttxt002.nlin")
Debug.Print BaanData
QueryEnd

' **** Check that text was written to table tttxt010 ****

Query = "select * from tttxt010 where tttxt010.ctxt=" & txtno
query_id = GetQid(Query)
BaanObj.ParseExecFunction "ottdllsql_query", "olesql_fetch(" & query_id & ")"
BaanData = GetData("tttxt010.text")
Debug.Print BaanData
QueryEnd

BaanObj.Quit
Set BaanObj = Nothing
End Sub

Function GetQid(ByVal Query As String) As Long
BaanObj.ParseExecFunction "ottdllsql_query", "olesql_parse(" & Chr(34) & Query & Chr(34) & ")"
GetQid = Val(BaanObj.ReturnValue)
If GetQid = 0 Then
QueryEnd
End If
End Function

Function GetData(ByVal Baan_Data As String) As String
BaanObj.ParseExecFunction "ottdllsql_query", "olesql_getstring(" & Chr(34) & Baan_Data & Chr(34) & "," & Chr(34) & Space(50) & Chr(34) & ")"
x = InStrRev(BaanObj.FunctionCall, Chr(34), Len(BaanObj.FunctionCall) - 2) + 1
y = Len(BaanObj.FunctionCall) - 1
GetData = Trim(Mid(BaanObj.FunctionCall, x, y - x))
End Function

Sub QueryEnd()
BaanObj.ParseExecFunction "ottdllsql_query", "olesql_break(" & query_id & ")"
BaanObj.ParseExecFunction "ottdllsql_query", "olesql_close(" & query_id & ")"
End Sub

mark_h
23rd September 2002, 16:30
Hi Al!

Couldn't you create a DLL that does the text write along with the commit? Then instead of doing the OLE functions for text.write you could call the DLL subroutine.

Mark

Al Smith
23rd September 2002, 18:24
Hi,
Thanks for the reply.
Yes, this is the way it's working now.
The dll for write.text is the only non-intrinsic dll needed by the application. I was attempting to eliminated the need for it.
Thanks,
Al.

Wim Kerkhoff
3rd December 2003, 06:34
Hi Al,

Did you get any further with this?

Wim

Al Smith
3rd December 2003, 16:57
Hi,
No. I'm still using a custom dll to do the text.write.

The way it's working is the "repair text" entered by the field tech is saved to a file on the server. Then the function "client2server" is called to get the file to the Baan box.

After that the custom dll is called to enter the repair text via a "text.write" call.

Al.

Wim Kerkhoff
3rd December 2003, 20:54
Ok. I guess I'll end up doing something similiar, by using FTP to automatically copy files from the Win32 system to the HPUX box.

Does anyone know where better documentation of the OLE object can be found? Ie, a list of functions in the ottdllsql_query object, getting metadata about a parsed query, and so on. I searched through BaanBoard, Google, Groups.Google.com, Baan Support, etc but haven't found anything useful yet, other then the code examples on BaanBoard/BaanFans.

I'm also wondering if there are other ways of accessing the BDB Library, without using OLE. Crystal's Baan driver doesn't use BW, just the plain library.

sramage
11th December 2013, 12:14
Hi,
(sorry for resurrecting this thread)

I'm facing the same problem, is there a how-to somewhere to create a custom dll ?