tbrault
25th March 2002, 09:50
On the form tdsls4125m000, I want that my program run automaticaly the specific button "collectif" (to confirm all my records for one project)). But, when I run my program, 2 possibility :
1 : nothing if confirmed
2 : only the active record is confirmed.
can you help me??
this is my program :

'----
Public Function test()
'--> DECLARATION
'--> Declaration variable session et champ--
Dim BaanSess As String
Dim OrdreKeyValue As String
Dim PositionKeyValue As String
'------------------------------------------
'--> Declaration valeur--------------------
Dim OrdreValue As String
Dim PositionValue As String
Dim FormNumber As Long
Dim option2 As Long
Dim ErrMessage1 As String
'------------------------------------------

'--> Programme

'--> Champs
BaanSess = "tdsls4125m000"
OrdreKeyValue = "tdsls045.orno"
PositionKeyValue = "tdsls045.pono"
'--> Valeur----
OrdreValue = "141356"
PositionValue = "60"
FormNumber = 1
option2 = 1
ErrMessage1 = Space(30)

Set baanobj = CreateObject("Baan4.Application")
'--> recherche
baanobj.ParseExecFunction "ottstpapihand", "stpapi.put.field(" & Chr(34) & BaanSess & Chr(34) & "," & Chr(34) & OrdreKeyValue & Chr(34) & "," & Chr(34) & OrdreValue & Chr(34) & ")"
baanobj.ParseExecFunction "ottstpapihand", "stpapi.put.field(" & Chr(34) & BaanSess & Chr(34) & "," & Chr(34) & PositionKeyValue & Chr(34) & "," & Chr(34) & PositionValue & Chr(34) & ")"
ret = baanobj.ParseExecFunction("ottstpapihand", "stpapi.find(" & Chr(34) & BaanSess & Chr(34) & "," & Chr(34) & ErrMessage1 & Chr(34) & ")")
'--> Clic
baanobj.ParseExecFunction "ottstpapihand", "stpapi.application.option(" & Chr(34) & BaanSess & Chr(34) & "," & FormNumber & "," & option2 & "," & Chr(34) & ErrMessage1 & Chr(34) & ")"
baanobj.ParseExecFunction "ottstpapihand", "stpapi.continue.process(" & Chr(34) & BaanSess & Chr(34) & "," & Chr(34) & ErrMessage1 & Chr(34) & ")"
baanobj.ParseExecFunction "ottstpapihand", "stpapi.end.session(" & Chr(34) & BaanSess & Chr(34) & ")"
End Function

alejandro
25th March 2002, 15:19
(BaaN IV c4)

That session has forms of type 3.
Try stpapi.change.view before find or instead find (try both)

ret = baanobj.ParseExecFunction("ottstpapihand", "stpapi.change.view(" & Chr(34) & BaanSess & Chr(34) & "," & Chr(34) & ErrMessage1 & Chr(34) & ")")

instead or before of

ret = baanobj.ParseExecFunction("ottstpapihand", "stpapi.find(" & Chr(34) & BaanSess & Chr(34) & "," & Chr(34) & ErrMessage1 & Chr(34) & ")")

Also I do not understand why you execute stpapi.continue.process becouse no one of the three forms have that choice.

Also try to make current, with a while, all possible values of OrdreKeyValue. Some BaaN sessions only updates records that are actuall ocurrences in the form.

You can before read those values using functions from ottdllsql_query. This dll can be invoked from your VB script before calling the session with apihand and take values directly form BaaN tables.

Hope this helps.