patwanirav
5th September 2013, 09:23
In ERP LN 6.1 FP7 when i write the AFS code for killing the session, the control pass from that line but when i see into shell it doesn't close the session.

For Example:
stpapi.enum.answer("whinh3512m000", "whinh0030", tcyesno.no)
stpapi.form.command("whinh2110m000", 5, "receive.order.lines", err.msg)
stpapi.end.session("whinh3512m000")

in the above code it doesn't kill the whinh3512m000 session.

But when i write the same code with 1 or 2 seconds delay it kills the session successfully.

For Example:
stpapi.enum.answer("whinh3512m000", "whinh0030", tcyesno.no)
stpapi.form.command("whinh2110m000", 5, "receive.order.lines", err.msg)
suspend(2000)
stpapi.end.session("whinh3512m000")


Now my problem is i don't want to put suspend in my code. So please help me to resolve this problem or give me some alternate solution.

Thanks in advance...

bhushanchanda
5th September 2013, 10:40
Hi,

You will need to add suspend() to your code because ideally, the process will take time to complete. If you don't use it, the session will not end as the AFS interrupted completion of the process which can cause problems. So, its better to use suspend().

mark_h
5th September 2013, 17:59
This is the correct forum Bhushan is correct - you really need to leave the suspend in. What you can do is keep decreasing the time to see when it stops closing the session. There is code in this forum that I posted that will use the kill command to clean up session - but I do not recommend it. Besides running that code will probably not take much less time than just using suspend. I use suspend all the time with API code.

patwanirav
6th September 2013, 06:32
Hi bhushanchanda & mark,

Is there any way to find out from shell that the session is still running through baan code?

Regards,
Nirav Patwa

bhushanchanda
6th September 2013, 06:56
Hi,

I am not sure what you want to do, but you can certainly use pstat() function to get the related information.

mark_h
6th September 2013, 14:10
Here is the thread I was referring too - http://www.baanboard.com/baanboard/showthread.php?s=&threadid=14201&highlight=kill. One of the problems with it is - do not have the session open manually that you are looking for.