tbrault
9th August 2002, 10:56
Hi!
I want to generate a inventory order.
For this, I use the session tdinv1220m00, and a vba code.
The program start normally, it created the warehouse stocktaking inventory, but the program don't stop.
When it go on the stapi.continue.process function, the program generate the inventory order, and continue to work, without go on the next code line.
Why, can you help me?
This my code :
'-----------------------------------

Function Generation_inventaire()
DoCmd.SetWarnings False
'--> Génération d'un ordre d'inventaire (warehouse stocktaking order)
'--> DECLARATION
'--> Declaration variable session et champ--
Dim BaanSess As String
Dim MagKeyValue1 As String
Dim MagKeyValue2 As String
'------------------------------------------
'--> Declaration valeur--------------------
Dim MagValue1 As String
Dim MagValue2 As String
Dim ErrMessage1 As String
'------------------------------------------


'--> Programme
Set baanobj = CreateObject("Baan4.Application")
'--> Champ-----
BaanSess = "tdinv1220m000"
MagKeyValue1 = "orno.f"
MagKeyValue2 = "orno.t"
'--> Valeurs communes
MagValue1 = "200"
MagValue2 = "200"
ErrMessage1 = Space(30)

'--> Valeur----
'--> recherche
baanobj.ParseExecFunction "ottstpapihand", "stpapi.put.field(" & Chr(34) & BaanSess & Chr(34) & "," & Chr(34) & MagKeyValue1 & Chr(34) & "," & Chr(34) & MagValue1 & Chr(34) & ")"
baanobj.ParseExecFunction "ottstpapihand", "stpapi.put.field(" & Chr(34) & BaanSess & Chr(34) & "," & Chr(34) & MagKeyValue2 & Chr(34) & "," & Chr(34) & MagValue2 & Chr(34) & ")"
'--> continue
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
'---------------------------------------------------