thieuf
18th January 2012, 17:19
Hello All,

For a customer I am buidling a session to create purchase quotes using AFS
on Baan IV SP 14 (and yes we have all the latest api's and what not ...)

When inserting a purchase quote on a Baan IV, the session tdpur1508s000 stays alive in the background. When I try to end it using AFS the program "hangs".


xpono = xpono + 10

stpapi.put.field("tdpur1101m000","tdpur001.qono",xqono.str)

xretval = stpapi.find("tdpur1101m000",err.msg)

stpapi.handle.subproc("tdpur1101m000","tdpur1102s000","add")
|stpapi.handle.subproc("tdpur1101m000","tdpur1508s000","add")
stpapi.continue.process("tdpur1101m000", err.msg)

if err.msg <> "" then
message(err.msg)
endif
stpapi.put.field("tdpur1102s000","tdpur002.cprj", tisun800.cprj)
stpapi.put.field("tdpur1102s000","tdpur002.item", tisun800.item)
stpapi.put.field("tdpur1102s000","tdpur002.pono", str$(xpono))
stpapi.put.field("tdpur1102s000","tdpur002.oqua", str$(tipcs520.oqan))

xretval = stpapi.insert("tdpur1102s000",true,err.msg)

if not isspace(err.msg) then
stpapi.recover("tdpur1102s000",err.msg)
else
stpapi.get.field("tdpur1102s000","tdpur002.pono",xpono.str)
endif

stpapi.end.session("tdpur1102s000")
|stpapi.end.session("tdpur1508s000")

stpapi.end.session("tdpur1101m000")

I have "piped" out end session and handle process for now so I can finish the creation without problem, but a lot of "tdpur1508s000" processes keep "hanging" in the background/shell.

Anyone any ideas?

thanks Thieu

thieuf
19th January 2012, 10:54
Hello All,

found the solution and just wanted to share....

first mistake
the subsession was not called by the main but by the first subsession:
tdpur1101m000 -> tdpur1102s000 -> tdpur1508s000

second mistake
I used "add" in sub process but should have used "kill"

third mistake
wrong location of the handle sub process

here is the correct script...

stpapi.handle.subproc("tdpur1101m000","tdpur1102s000","add")
stpapi.continue.process("tdpur1101m000", err.msg)

stpapi.put.field("tdpur1102s000","tdpur002.cprj", tisun800.cprj)
stpapi.put.field("tdpur1102s000","tdpur002.item", tisun800.item)
stpapi.put.field("tdpur1102s000","tdpur002.pono", str$(xpono))
stpapi.put.field("tdpur1102s000","tdpur002.oqua", str$(tipcs520.oqan))

xretval = stpapi.insert("tdpur1102s000",true,err.msg)

if not isspace(err.msg) then
stpapi.recover("tdpur1102s000",err.msg)
else
stpapi.get.field("tdpur1102s000","tdpur002.pono",xpono.str)
endif

stpapi.handle.subproc("tdpur1102s000","tdpur1508s000","kill")
stpapi.end.session("tdpur1102s000")

stpapi.end.session("tdpur1101m000")