rope11
14th September 2005, 14:05
Hi!
I am using Lotus Notes and Baan 40 c62
I have problems with return value, when i update fields.
Update is succesful, but return value is empty string.
my code:
Call putfield (dllName , "tfacp1100m000" , "tfacp100.ninv" , prenos , BaanObj)
Call putfield (dllName , "tfacp1100m000" , "tfacp100.suno" , docRac.STTerjatelj(0) , BaanObj)
Call putfield (dllName , "tfacp1100m000" , "tfacp100.isup" , docRac.TXRacun(0) , BaanObj)
Call putfield (dllName , "tfacp1100m000" , "tfacp100.refr" , docRac.TXModel(0) & "-" & docRac.TXSklic(0) , BaanObj)
Set NDatum = New notesdatetime(docRac.DTIzstavitve(0))
Call putfield (dllName , "tfacp1100m000" , "tfacp100.invd" , BaanDatum(NDatum) , BaanObj)
Call putfield (dllName , "tfacp1100m000" , "tfacp100.ccur" , docRac.TXVal(0) , BaanObj)
Call putfield (dllName , "tfacp1100m000" , "tfacp100.amnt" , Cstr(predznak * docRac.STZnesekV(0)) , BaanObj)
Call putfield (dllName , "tfacp1100m000" , "tfacp100.stin" , "1" , BaanObj)
BaanObj.ParseExecFunction dllName, "stpapi.update(" & Chr(34) & "tfacp1100m000" & Chr(34) & ",1," & Chr(34) & " " & Chr(34) & ")"
vrneP = BaanObj.ReturnValue
vrne = BaanObj.FunctionCall
BaanObj.ParseExecFunction dllName, "stpapi.get.mess.code(" & Chr(34) & "tfacp1100m000" & Chr(34) & "," & Chr(34) & " " & Chr(34) & ")"
vrne = BaanObj.ReturnValue
If vrneP = "1" Then
........
Any idea what could be wrong (return value must be "1")
Regards
mark_h
14th September 2005, 15:30
Couple of questions - Is there more code involved? Are you doing a find before you execute the update? Or do you really want to do an insert?
rope11
14th September 2005, 15:58
Yes there is more code involved:
prenos="250001212"
Call putfield (dllName , "tfacp1100m000" , "tfacp100.ninv" , prenos , BaanObj)
' Call putfield (dllName , "tfacp1100m000" , "tfacp100.ninv" , "23130002" , BaanObj)
BaanObj.ParseExecFunction dllName, "stpapi.find(" & Chr(34) & "tfacp1100m000" & Chr(34) & "," & Chr(34) & " " & Chr(34) & ")"
vrneFind = BaanObj.ReturnValue
Call putfield (dllName , "tfacp1100m000" , "tfacp100.ninv" , prenos , BaanObj)
Call putfield (dllName , "tfacp1100m000" , "tfacp100.suno" , docRac.STTerjatelj(0) , BaanObj)
Call putfield (dllName , "tfacp1100m000" , "tfacp100.isup" , docRac.TXRacun(0) , BaanObj)
Call putfield (dllName , "tfacp1100m000" , "tfacp100.refr" , docRac.TXModel(0) & "-" & docRac.TXSklic(0) , BaanObj)
Set NDatum = New notesdatetime(docRac.DTIzstavitve(0))
Call putfield (dllName , "tfacp1100m000" , "tfacp100.invd" , BaanDatum(NDatum) , BaanObj)
Call putfield (dllName , "tfacp1100m000" , "tfacp100.ccur" , docRac.TXVal(0) , BaanObj)
Call putfield (dllName , "tfacp1100m000" , "tfacp100.amnt" , Cstr(predznak * docRac.STZnesekV(0)) , BaanObj)
Call putfield (dllName , "tfacp1100m000" , "tfacp100.stin" , "1" , BaanObj)
If vrneFind = "1" Then
BaanObj.ParseExecFunction dllName, "stpapi.update(" & Chr(34) & "tfacp1100m000" & Chr(34) & ",1," & Chr(34) & " " & Chr(34) & ")"
Else
BaanObj.ParseExecFunction dllName, "stpapi.insert(" & Chr(34) & "tfacp1100m000" & Chr(34) & ",1," & Chr(34) & " " & Chr(34) & ")"
End If
vrneP = BaanObj.ReturnValue
vrne = BaanObj.FunctionCall
vrneR = razdelistring(vrne,{"})
BaanObj.ParseExecFunction dllName, "stpapi.get.mess.code(" & Chr(34) & "tfacp1100m000" & Chr(34) & "," & Chr(34) & " " & Chr(34) & ")"
vrne = BaanObj.ReturnValue
vrneP=preveriUpdate(baanObj, prenosR,"tfacp100.ninv", Cstr(predznak * docRac.STZnesekV(0)) , "tfacp100.amnt", "tfacp1100m000")
' If vrne = "" And vrneP = "1" Then
If vrneP = "1" Then
BaanObj.ParseExecFunction dllName, "stpapi.handle.subproc(" & Chr(34) & "tfacp1100m000" & Chr(34) & "," & Chr(34) & "tfacp9199m000" & Chr(34) & "," & Chr(34) & "add" & Chr(34) & ")"
BaanObj.ParseExecFunction dllName, "stpapi.zoom.option(" & Chr(34) & "tfacp1100m000" & Chr(34) & "," & "1" & "," & Chr(34) & "tfacp9199m000" & Chr(34) & "," & Chr(34) & " " & Chr(34) & ")"
BaanObj.ParseExecFunction dllName, "stpapi.continue.process(" & Chr(34) & "tfacp9199m000" & Chr(34) & "," & Chr(34) & " " & Chr(34) & ")"
Call putfield (dllName , "tfacp9199m000" , "tfacp199.ninv" , prenosR , BaanObj)
BaanObj.ParseExecFunction dllName, "stpapi.find(" & Chr(34) & "tfacp9199m000" & Chr(34) & "," & Chr(34) & " " & Chr(34) & ")"
vrneFindDatum = BaanObj.ReturnValue
Set NDatum = New notesdatetime(docRac.DatumSkeniranja(0))
Call putfield (dllName , "tfacp9199m000" , "tfacp199.datp" , BaanDatum(NDatum) , BaanObj)
Set NDatum = New notesdatetime(docRac.DTIzstavitve(0))
Call putfield (dllName , "tfacp9199m000" , "tfacp199.invd" , BaanDatum(NDatum) , BaanObj)
Set NDatum = New notesdatetime(docRac.DTDobave(0))
Call putfield (dllName , "tfacp9199m000" , "tfacp199.datd" , BaanDatum(NDatum) , BaanObj)
Call putfield (dllName , "tfacp9199m000" , "tfacp199.reuv" , docRac.TXCarPostopek(0) , BaanObj)
Call putfield (dllName , "tfacp9199m000" , "tfacp199.reup" , docRac.TXPredCarPostopek(0) , BaanObj)
BaanObj.ParseExecFunction dllName, "stpapi.continue.process(" & Chr(34) & "tfacp9199m000" & Chr(34) & "," & Chr(34) & " " & Chr(34) & ")"
If vrneFindDatum = "1" Then
BaanObj.ParseExecFunction dllName, "stpapi.update(" & Chr(34) & "tfacp9199m000" & Chr(34) & ",1," & Chr(34) & " " & Chr(34) & ")"
Else
BaanObj.ParseExecFunction dllName, "stpapi.insert(" & Chr(34) & "tfacp9199m000" & Chr(34) & ",1," & Chr(34) & " " & Chr(34) & ")"
End If
There is more code, but step by step
I just find out, that tis code is working well on Baan (I don't know the version).
I think the problem could be wrong version of Baan or patches (not) installed :confused:
mark_h
14th September 2005, 16:11
Usually when I do an update I update only those fields I can. So instead of putting all those fields, try the update with only those fields that will be changed. Maybe just test updating amount. I am not sure this is the problem, but something to try.
rope11
14th September 2005, 16:37
No succes -> code:
Call putfield (dllName , "tfacp1100m000" , "tfacp100.ninv" , "25001212" , BaanObj)
Call BaanFunkcija (dllname, "stpapi.find", 3, "tfacp1100m000", blank, "", "", True, baanObj)
vrneFind = BaanObj.ReturnValue
If vrneFind ="1" Then
Call putfield (dllName , "tfacp1100m000" , "tfacp100.amnt" , "2500", BaanObj)
Call BaanFunkcija (dllname, "stpapi.update", 5, "tfacp1100m000", 1, blank, "", True, baanObj)
vrneP=baanObj.returnValue
End If
vrneP is "" :mad:
the record is updated. Any idea what could be wrong?
mark_h
15th September 2005, 03:00
So the record is updated correctly? It just does not return a value - is this correct? Or did you mean to say the record was "not updated". I have seen error messages when commands worked.
I just noticed that you mentioned this works on someone elses version of Baan. It could mean(as you mentioned) that you need to update your tools version, stpapi libraries or maybe even the session object. I recommend contacting Baan - they would be most familiar with what you should be running.
rope11
15th September 2005, 14:01
Yes the record is updated correctly.
Thanks for the advice