david7
22nd May 2012, 13:41
Hi,

I have a program that in some case it will kick the user out. That is a mandatory requiremnt from my boss.

I was able to kick a user by killing all the processes. The problem is, that in this way, there are a lot of application locks, as a result. And I need to remove these locks.

I have tried the appl.delete function, but I will have to give it specific details like the table code and record to use it. for example, a lock on a PO I will have to give it tdpur040 & 32532 (PO number), but I do not have this information! All I have is the session PID and prgoram name (tdpur0401m000 for example). I have looked at all the following functions and there are not useful for my case:
http://www.baanboard.com/programmers_manual_baanerp_help_functions_appl_application_locks_synopsis

Is there anyway that I can remove ALL the locks that the current user has?

- D7

Eddie Monster
22nd May 2012, 14:53
Could you use session ttstpdelrlock?

david7
22nd May 2012, 15:17
Thanks Eddie,

I need a way to activate this session from within my code. I am not sure if AFS works with company 000, or if the user has permission to use it

Any other suggestions?

Eddie Monster
22nd May 2012, 15:47
Not sure if AFS works in company 000 either. I would see if you can invoke company 000 sessions from AFS (or perhaps another BaanBoarder can answer this) first since you will be using natural Baan functionality to remove the lock.

If you can't... perhaps...

Once you determine the user and session ID you could use dynamic SQL to delete the record from the table.

mark_h
22nd May 2012, 16:19
Yes - it is possible to use AFS code for company 000 sessions. You just need to be familiar with how to use AFS. Soemtimes figuring out fields can be tough. In this case just glancing at ttstpdelrlock it looks like you could put the company number, the user.f and user.t and do a continue. I have never really used that session, but it might be pretty simple. Or you can just run a query against ttadv997 and 998 in company 000 - not really sure of the header table. You can check out those tables.