steiner
9th May 2005, 22:27
I'm writing an AFS to match purchase order invoices to receipts. The problem I'm having is handling cascaded child sessions. Specifically, executing a continue.process on session tfacp1110s000 starts the sub-session tfacp1130s000 which I can handle, but before I can handle it tfacp1130s000 starts it's own sub-session tfacp1131s000. So my function server hangs due to the lack of a handle for the tfacp1131s000. Has anyone else written an AFS to match purchase order invoices to receipts or handled this problem for another reason that is willing to share a solution?
steiner
mark_h
10th May 2005, 14:35
We used Qkey in tfacp1131s000 to stop the session. I did not write this code but here is what we did.
Calling code:
|------------------------------------------------------------
| I'm using the free$ (baan system variable) to let some
| sessions (tfacp1131s000, tfacp1133s000) know they were
| called from this contractor api process. Each of these
| sessions were compiled with Qkey overriding event calls.
|------------------------------------------------------------
free$ = "contractor.api"
|bunch of code here that I cut to show what we did.
| 5.5 tfacp1133s000 End
stpapi.end.session(sess.acp1133)
| 4.2 tfacp1230s000 End
stpapi.end.session(sess.acp1230)
stpapi.handle.subproc(sess.acp1110, sess.acp1130, "add")
stpapi.continue.process(sess.acp1110, e.msg)
e.msg = ""
stpapi.handle.subproc(sess.acp1130, sess.acp1131, "add")
stpapi.end.session(sess.acp1131)
stpapi.handle.subproc(sess.acp1130, sess.acp1140, "add")
stpapi.application.option( sess.acp1130, 1, 0, e.msg ) | Approve button
And the qkey code in tfacp1131s000:
before.program:
if free$ = "contractor.api" then
end()
else
|#call
endif
There are other wrapper programs that could be used besides qkey - RMCis also has a product. Plus there is the extend source code post by ~Vamsi in the code and utlities forum.