baan2tm0
1st April 2006, 15:21
Let's say, using AFS, i want to set a string field value to blank or nothing.
My code doesn't seem to work. This should update the field tccom001.info to blank:


stpapi.browse.set("tccom0101m000","first.set",error.msg)
stpapi.put.field("tccom0101m000","tccom001.info","")
stpapi.update("tccom0101m000",true,error.msg)

RieseUSA
2nd April 2006, 01:47
The same code correctly blanks out the 'E-mail' (tccom001.info) field on my test system.

Did you check the error message 'error.msg' after the update?

How old are your standard program components, mainly 'ottstpapihand', which provides the Application Function Server (AFS) functionality. You can the check the object idents on a Windows server with the bic_info command, e.g., bic_info -w ottstpapihand'.

Yours,
Stephan

baan2tm0
3rd April 2006, 08:46
actually i've written the code in vb.net/vb6. it works fine if i update it to something else other than blank. here's the code when i update it with a value

Dim bobj As Object
Dim sFunctionCall As String = Space(100)
Dim mSession As String = "tccom0101m000"
Dim EmpNo As String

bobj = CreateObject("Baan4.Application")
bobj.Timeout = 10

bobj.ParseExecFunction("ottstpapihand", "stpapi.browse.set(" & Chr(34) & mSession & Chr(34) & "," & Chr(34) & "first.set" & Chr(34) & "," & Chr(34) & sFunctionCall & Chr(34) & ")")
bobj.ParseExecFunction("ottstpapihand", "stpapi.put.field(" & Chr(34) & mSession & Chr(34) & "," & Chr(34) & "tccom001.info" & Chr(34) & "," & Chr(34) & "foo@foo" & Chr(34) & ")")
bobj.ParseExecFunction("ottstpapihand", "stpapi.update(" & Chr(34) & mSession & Chr(34) & ",1," & Chr(34) & sFunctionCall & Chr(34) & ")")
bobj.ParseExecFunction("ottstpapihand", "stpapi.end.session(" & Chr(34) & mSession & Chr(34) & "," & Chr(34) & sFunctionCall & Chr(34) & ")")

bobj.Quit()
bobj = Nothing

MsgBox("ok")

and here's the code when i update to to blank/nothing, which doesn't work:

Dim bobj As Object
Dim sFunctionCall As String = Space(100)
Dim mSession As String = "tccom0101m000"
Dim EmpNo As String

bobj = CreateObject("Baan4.Application")
bobj.Timeout = 10

bobj.ParseExecFunction("ottstpapihand", "stpapi.browse.set(" & Chr(34) & mSession & Chr(34) & "," & Chr(34) & "first.set" & Chr(34) & "," & Chr(34) & sFunctionCall & Chr(34) & ")")
bobj.ParseExecFunction("ottstpapihand", "stpapi.put.field(" & Chr(34) & mSession & Chr(34) & "," & Chr(34) & "tccom001.info" & Chr(34) & "," & Chr(34) & "" & Chr(34) & ")")
bobj.ParseExecFunction("ottstpapihand", "stpapi.update(" & Chr(34) & mSession & Chr(34) & ",1," & Chr(34) & sFunctionCall & Chr(34) & ")")
bobj.ParseExecFunction("ottstpapihand", "stpapi.end.session(" & Chr(34) & mSession & Chr(34) & "," & Chr(34) & sFunctionCall & Chr(34) & ")")

bobj.Quit()
bobj = Nothing

MsgBox("ok")

when i do a 'bic_info -w ottstpapihand' i get this:

---------------------------OBJECT IDENTS--------------------------------
@(#)/usr4/triton6/bse/tools/ttB40_c5/pttstp/pstpapihand0, 99/03/03 [12:24], From
rrens
@(#)-DREL6_1
@(#)bic_global 8.9:2/23/99 Copyright (c) Baan International b.v.
@(#)bic_object 7.7.1.3:2/19/99 Copyright (c) Baan International b.v.
@(#)bic_event 8.1:4/20/98 Copyright (c) Baan International b.v.
@(#)bic_shell, 08-1994/R1, Copyright (c) Baan International b.v.
@(#)bic_fork 1.1:3/1/95 Copyright (c) Baan International b.v.
@(#) October 1997: Added argmuments (do.update) in functions insert/update/de
lete
@(#) October 1997: Added function get.mess.code
@(#) December 1997: After update/insert new values are taken back
@(#) December 1997: Solved problem with multiple forms
@(#) December 1997: Solved problem with more than 1 session
@(#) April 1998: Session created in separate process group
@(#) DF19590,98/10/05: Baan is not responding after delete action
@(#) December 1998: Update and save action combined in 1 call
@(#) December 1998: Performance improvements

help please help!! :o :confused: :(

RieseUSA
3rd April 2006, 14:33
I am not familiar with the VB.NET/VB6 coding, but your Baan standard program is from 99/03/03, which is very old. There have been numerous fixes since then and one might also help with this problem.

I would suggest to check the SSA Global OnePoint Support website for the latest solution for the standard program and install that one.

You could check for solutions for ottstpapihand on the support website first, maybe one lists this problem and you do not have to update to the latest standard program, which might have some other requirements regarding the portingset, etc.

Yours,
Stephan

csecgn
10th April 2006, 14:08
Just an idea:

you've written:

bobj.ParseExecFunction("ottstpapihand", "stpapi.put.field(" & Chr(34) & mSession & Chr(34) & "," & Chr(34) & "tccom001.info" & Chr(34) & "," & Chr(34) & "" & Chr(34) & ")")

In my opinion the result would be empty, but not 2 doubleqotes (""").

Maybe the change of the "" to chr$(34) & chr$(34) would give a better result

hth

Regards
csecgn

baan2tm0
12th April 2006, 09:36
:( here's the new code:

Dim bobj As Object
Dim sFunctionCall As String = Space(100)
Dim mSession As String = "tccom0101m000"
Dim EmpNo As String

bobj = CreateObject("Baan4.Application")
bobj.Timeout = 10

bobj.ParseExecFunction("ottstpapihand", "stpapi.browse.set(" & Chr(34) & mSession & Chr(34) & "," & Chr(34) & "first.set" & Chr(34) & "," & Chr(34) & sFunctionCall & Chr(34) & ")")
bobj.ParseExecFunction("ottstpapihand", "stpapi.put.field(" & Chr(34) & mSession & Chr(34) & "," & Chr(34) & "tccom001.info" & Chr(34) & "," & Chr(34) & Chr(34) & ")")
bobj.ParseExecFunction("ottstpapihand", "stpapi.update(" & Chr(34) & mSession & Chr(34) & ",1," & Chr(34) & sFunctionCall & Chr(34) & ")")
bobj.ParseExecFunction("ottstpapihand", "stpapi.end.session(" & Chr(34) & mSession & Chr(34) & "," & Chr(34) & sFunctionCall & Chr(34) & ")")

bobj.Quit()
bobj = Nothing

MsgBox("ok")

mark_h
12th April 2006, 16:22
Have you tried spaces - & Chr(34) & " " & Chr(34)?

Interesting - there are about 10 spaces in the above line, but it looks like something strips out the extra spaces.

csecgn
12th April 2006, 18:51
Maybe something like

chr$(34) & chr$(34) & chr$(34) & chr$(34)

Looks crazy... .

I've tryed to test it, but something on my PC is wrong (cannot connect to baan with OLE) and actually I don't have the time to correct it.

Another idea: write a baan dll with the AFS Code you need and call this dll by OLE.

hth

Regards
csecgn

mark_h
12th April 2006, 21:52
This worked from excel to my system:

Dim sFunctionCall As String
Dim mSession As String
Dim EmpNo As String

sfuntioncall = Space(100)
mSession = "tccom0101m000"
BaanObj.ParseExecFunction "ottstpapihand", "stpapi.browse.set(" & Chr(34) & mSession & Chr(34) & "," & Chr(34) & "first.set" & Chr(34) & "," & Chr(34) & sFunctionCall & Chr(34) & ")"
BaanObj.ParseExecFunction "ottstpapihand", "stpapi.put.field(" & Chr(34) & mSession & Chr(34) & "," & Chr(34) & "tccom001.info" & Chr(34) & "," & Chr(34) & Chr(34) & ")"
BaanObj.ParseExecFunction "ottstpapihand", "stpapi.update(" & Chr(34) & mSession & Chr(34) & ",1," & Chr(34) & sFunctionCall & Chr(34) & ")"
BaanObj.ParseExecFunction "ottstpapihand", "stpapi.end.session(" & Chr(34) & mSession & Chr(34) & "," & Chr(34) & sFunctionCall & Chr(34) & ")"

If it does not work on your system then I recommend updating you stpapi objects and the session itself just like stephan recommended. There is no guarantee that this will solve the problem, but it might.

Al Smith
12th April 2006, 22:18
Hi,
For what it's worth, I copied your original code into vb.net on my development computer and it worked just fine.
Al.

RieseUSA
12th April 2006, 22:21
So maybe my suggestion to update the standard program would still be the way to go.

Al, how old is your standard program, especially ottstpapihand?

Yours,
Stephan

Al Smith
12th April 2006, 22:40
Hi,@(#)/usr4/triton6/bse/tools/ttB40_c6/pttstp/pstpapihand0, 02/09/26 [21:47], From tseeleyAl.

RieseUSA
12th April 2006, 22:44
It fails with the object from 99/03/03, it works with 02/09/26 and newer, I will stick with my suggestion to update.

Yours,
Stephan