Baanboard.com

Go Back   Baanboard.com > Forum > Baan Quick Support: Functional & Technical > Tools Development

User login

Frontpage Sponsor

Main

Poll
For ERP LN feature pack upgrade, what method of install are you using?
Installation Wizard into existing VRC
35%
Installation Wizard into new VRC
42%
Manual into existing VRC
3%
Manual into new VRC
19%
Total votes: 31

Baanboard at LinkedIn


Reference Content

Reply
 
Thread Tools Display Modes
  #1  
Old 23rd January 2002, 14:45
Caner.B's Avatar
Caner.B Caner.B is offline
Senior Member
 
Join Date: Aug 2001
Location: Turkey
Posts: 107
Caner.B is on a distinguished road
Baan: B-IV c3 Mcr0 - DB: Informix ,Oracle 9.2 - OS: Hp-Ux, AIX 5.2
Ýs it possible to let a session run by only one user.

Hi,

Is it possible to let a session run only by one user at the same time.

For example :
if the session is in use by a user and another user try to run it. it will give a message that the sesion is in use.

Thanks

Caner
Reply With Quote
  #2  
Old 23rd January 2002, 14:52
steveauckly steveauckly is offline
Senior Member
 
Join Date: Sep 2001
Location: Kansas City, MO, USA
Posts: 168
steveauckly is on a distinguished road
Baan: Baan IVc4 SP26 - DB: Oracle 10g - OS: Windows XP Pro
yes, it is

See the "application lock" functions:

appl.set
appl.get.user
appl.delete

When a user enters the session, test to see if there is a lock. If so, give the appropriate message and end.program(). If not, set a new lock, and allow the user to use the session.

Good luck,
Steve
Reply With Quote
  #3  
Old 23rd January 2002, 14:54
emani80's Avatar
emani80 emani80 is offline
Junior Member
 
Join Date: Jan 2002
Posts: 24
emani80 is on a distinguished road
Baan: BaanIVc4 - DB: SQL7.0 - OS: Windows NT
Yes, If you are writing code your self, you can lock the session using appl.set()and appl.delete() Commands to lock and unlock the session.
Reply With Quote
  #4  
Old 23rd January 2002, 20:20
popeye's Avatar
popeye popeye is offline
Senior Member
 
Join Date: Oct 2001
Location: CA, USA
Posts: 149
popeye is on a distinguished road
Hi,
You could do the following.
Hope this helps.
Cheers,
Madhu

Code:
before.program:
if appl.set("tdpuro155m000", APPL.EXCL) <> 0 then
		mess("tdpur.used.by", 1,strip$(tdpurodll00003.get.user.with.lock("td","pur","o155m000")))
		|* This session is currently being used by %s.
		exit()
	endif

function extern domain tcmcs.str12 tdpurodll00003.get.user.with.lock(domain ccboi.cpac hold.cpac,
					 			     domain ccboi.cmod hold.cmod,
								     domain ccboi.cses hold.cses)
{
	DLLUsage       
	***************************************************************************** 
	* Author        : Madhu Nair
        * Date          : 08/20/01
	* Description   : This DLL function returns the user who has locked the session. 
        * Parameters    : 1. Package
	*                 2. Module
        *                 3. Session
        * Return Values : 1. Keyname
        *****************************************************************************
	EndDLLUsage
	
	table tttadv997	| Maintain Application Lock Headers
	table tttadv998 | Maintain Application Locks

	
	select ttadv998.*, ttadv997.*
	from   ttadv998, ttadv997
	where  ttadv998.ocpac = :hold.cpac and
               ttadv998.ocmod = :hold.cmod and
	       ttadv998.ocses = :hold.cses and
	       ttadv998._compnr = "000" and
               ttadv997._index1 = {ttadv998.applid} and
	       ttadv997._compnr = "000" 
	as set with 1 rows
	selectdo
		return(ttadv997.user)
	endselect
	return("")
}
Reply With Quote
Sponsored Links
  #5  
Old 24th January 2002, 14:47
Caner.B's Avatar
Caner.B Caner.B is offline
Senior Member
 
Join Date: Aug 2001
Location: Turkey
Posts: 107
Caner.B is on a distinguished road
Baan: B-IV c3 Mcr0 - DB: Informix ,Oracle 9.2 - OS: Hp-Ux, AIX 5.2
Tank you very much .

Thanks a lot for all your replies.

It works great!!

Caner
Reply With Quote
  #6  
Old 28th January 2003, 13:06
amarpreet's Avatar
amarpreet amarpreet is offline
Senior Member
 
Join Date: Jul 2002
Location: Chandigarh India
Posts: 124
amarpreet is on a distinguished road
Baan: BaaN IVC4 - DB: PL-SQL - OS: Windows NT
New to programming.

I am very new to tools development. I just tries to use this thread to restrict a session to be used by only a single person.

This works good while testing but sometimes application locks created by users are not automatically deleted even after user clos all the session & even logged out.

I have to manually delete application lock to use session again. Please find attached the script & suggest the remedy.

Thanks in advance

Code:
|******************************************************************************
|* tddel2410  0  VRC B40l c4 dil 
|* Print MRP Shortage Report
|* General_User_NT               
|* 2002-01-18
|******************************************************************************
|* Main table tibom010 Production BOMs, Form Type 4
|******************************************************************************

|****************************** declaration section ***************************
declaration:

	table	ttibom010	| Production BOMs
	table	ttiitm001	| Items
	table	ttimps520	| MPS orders
	table	ttimrp020	| MRP orders
	table	tticst001	| Items
	table	ttdinv001	| Inv. 
	table	ttdinv150	| Inv. 

	extern	domain	tcitem        	mitm.f	fixed
	extern	domain	tcitem        	mitm.t	fixed
	extern	domain	tcitem        	bom.mitm,item,order.mitm |		order.mitm(100)
	extern	domain	tcitem        	bom.sitm,mitm,mfg.item,fant1.mitm,fant1.sitm
	extern	domain	tcqana		fant1.quan,bom.qty.per.set,tot.qty
	extern	domain	tcitem        	sitm.f	fixed
	extern	domain	tcitem        	sitm.t	fixed
	extern	domain	tccitg        	citg.f	fixed
	extern	domain	tccitg        	citg.t	fixed
	extern	domain	tcemno		buyr.f,sitm.buyr	
	extern	domain	tcemno		buyr.t	
	extern	domain	tckitm		kitm.f,type,item.type,		order.type(1000)
	extern	domain	tckitm		kitm.t
	extern	domain	tcdate		date.f,date,stdt.t,		order.date(1000)
	extern	domain	tcdate		date.t,today
	extern	domain	tiqbm2		bom.qana,cst.qana,qty |,	order.qty(1000)
	extern	domain	tcyesno		bom.cpha
	extern	domain	tcorno		or.no,			order.no(1000)
	extern	domain	tcosys		osys,			order.sys(1000)	
	extern	domain	tcqana		qty.on.hand,reqd.qty, safety.stock, qty.on.order
	extern	domain	tccuni		sitm.cuni
	extern	domain	tcsern		i,j,n	
	extern	domain	tcdsca		sitm.dsca
	extern	string  next(16,10000)
	extern	string  main.item(16,10000)



|****************************** form section **********************************

form.1:
init.form:
	get.screen.defaults()

|****************************** choice section ********************************

choice.cont.process:
on.choice:
	execute(print.data)

choice.print.data:
on.choice:
	if rprt_open() then
		read.main.table()
		rprt_close()
	else
		choice.again()
	endif

|****************************** field section *********************************
field.mitm.f:
when.field.changes:
	mitm.t = mitm.f
before.zoom:
	tiitm001.item = mitm.f
field.mitm.t:
before.zoom:
	tiitm001.item = mitm.t
field.sitm.f:
when.field.changes:
	sitm.t = sitm.f
field.kitm.f:
when.field.changes:
	kitm.t = kitm.f
field.buyr.f:
when.field.changes:
	buyr.t = buyr.f
field.date.f:
when.field.changes:
	date.t = date.f
|****************************** function section ******************************
functions:
function read.main.table()

{
	appl.set("00112334455", APPL.WRITE + APPL.WIDE)

	if appl.set("tddel2410", APPL.EXCL) > 0 then
	message("This session is already in use")
	return
	endif

	today = date.num()
	n=0
	select	tibom010.sitm:bom.sitm,tibom010.mitm:bom.mitm,tibom010.qana:bom.qana,
		tibom010.cpha:bom.cpha ,tiitm001.kitm:item.type,tiitm001.dsca:sitm.dsca,tiitm001.cuni:sitm.cuni,tiitm001.buyr:sitm.buyr
	from	tibom010  ,tiitm001
	where 	tibom010._index2 inrange {:sitm.f, :mitm.f} and {:sitm.t, :mitm.t}
	and	tibom010.sitm refers to tiitm001
	and	( tibom010.exdt=0 or tibom010.exdt > date.num() )
	selectdo

		if item.type = tckitm.purchase  then
			select 	tibom010.mitm,tibom010.sitm,tibom010.qana,tibom010.cpha,tiitm001.dsca,tiitm001.cuni
			from	tibom010, tiitm001
			where 	tibom010._index2 = {:bom.sitm}
			and	tibom010.mitm refers to tiitm001
			and	( tibom010.exdt=0 or tibom010.exdt > date.num() )
			selectdo
				bom.qty.per.set = 0
				order.mitm      = " "
				select 	tibom010.mitm:fant1.mitm,tibom010.sitm:fant1.sitm,tibom010.qana:fant1.quan
				from	tibom010
				where	tibom010._index2 = {:tibom010.mitm}
				and	tibom010.cpha = tcyesno.yes
				and	( tibom010.exdt=0 or tibom010.exdt > date.num() )
				selectdo
					bom.qty.per.set = fant1.quan * tibom010.qana
					order.mitm	= fant1.mitm
					select timrp020.item,timrp020.oqan
					from	timrp020
					where	timrp020._index2 = {:order.mitm}
					and	timrp020._index3 <= {:stdt.t}
					selectdo
						reqd.qty      = reqd.qty + (timrp020.oqan * bom.qty.per.set)
					endselect

					select timps520.item,timps520.oqan
					from	timps520
					where	timps520._index3  = {:order.mitm}
					and	timps520._index2 <= {:stdt.t}
					selectdo
						reqd.qty      = reqd.qty + (timps520.oqan * bom.qty.per.set)
					endselect
				selectempty
					bom.qty.per.set = tibom010.qana
					order.mitm	= tibom010.mitm
					select timrp020.item,timrp020.oqan
					from	timrp020
					where	timrp020._index2 = {:order.mitm}
					and	timrp020._index3 <= {:stdt.t}

					selectdo
						reqd.qty      = reqd.qty + (timrp020.oqan * bom.qty.per.set)
					endselect

					select timps520.item,timps520.oqan
					from	timps520
					where	timps520._index3  = {:order.mitm}
					and	timps520._index2 <= {:stdt.t}
					selectdo
						reqd.qty      = reqd.qty + (timps520.oqan * bom.qty.per.set)
					endselect
				endselect
			endselect
			select 	ticst001.subd,ticst001.issu,tcmcs003.cwar
			from	ticst001,tcmcs003
			where	ticst001._index3 = {:tibom010.sitm}
			and	ticst001.cwar refers to tcmcs003
			and	tcmcs003.nwrh=tcyesno.yes
			and  	( ticst001.subd > 0 or ticst001.issu > 0 )
			selectdo
				reqd.qty = reqd.qty + ticst001.subd + ticst001.issu	
			endselect
			qty.on.hand = 0
			safety.stock= 0
			qty.on.order= 0
			select tdinv001.stoc,tdinv001.sfst,tdinv001.ordr,tcmcs003.cwar
			from	tdinv001, tcmcs003
			where	tdinv001._index2 = {:tibom010.sitm}
			and	tdinv001.cwar refers to tcmcs003
			and	tcmcs003.nwrh=tcyesno.yes
			selectdo
				qty.on.hand = qty.on.hand + tdinv001.stoc
				safety.stock= safety.stock+ tdinv001.sfst
|				qty.on.order= qty.on.order+ tdinv001.ordr
			endselect
			select tdinv150.qana
			from	tdinv150
			where	tdinv150._index2 = {:tibom010.sitm}
			and	tdinv150._index1 = {tckoor.act.pur}
			and	tdinv150.kotr    = tckotr.receipt
			selectdo
				qty.on.order= qty.on.order+ tdinv150.qana
			endselect				
			mfg.item = bom.mitm
				rprt_send()
			reqd.qty = 0
		else
			n=n+1
			next(1,n)      = bom.sitm
			main.item(1,n) = bom.mitm
		endif
	endselect
	for i = 1 to n
		mitm = next(1,i)
		search()
	endfor			
APPL.DELETE("00112334455")
}
|654765
|APPL.DELETE("00112334455")

|***********************************************************************************

function search()
{
	select	tibom010.sitm:bom.sitm,tibom010.mitm:bom.mitm,tibom010.qana:bom.qana,
		tibom010.cpha:bom.cpha,tiitm001.kitm:item.type,tiitm001.dsca:sitm.dsca,tiitm001.cuni:sitm.cuni,tiitm001.buyr:sitm.buyr
	from	tibom010 ,tiitm001
	where 	tibom010._index1 = {:mitm}
	and	tibom010.sitm refers to tiitm001
	and	( tibom010.exdt=0 or tibom010.exdt > date.num() )

	selectdo
		if item.type = tckitm.purchase  then
			select 	tibom010.mitm,tibom010.sitm,tibom010.qana,tibom010.cpha,tiitm001.dsca,tiitm001.cuni | tibom010.*,tiitm001.*
			from	tibom010, tiitm001
			where 	tibom010._index2 = {:bom.sitm}
			and	tibom010.mitm refers to tiitm001
			and	( tibom010.exdt=0 or tibom010.exdt > date.num() )
			selectdo
				bom.qty.per.set = 0
				order.mitm      = " "
				select 	tibom010.mitm:fant1.mitm,tibom010.sitm:fant1.sitm,tibom010.qana:fant1.quan
				from	tibom010
				where	tibom010._index2 = {:tibom010.mitm}
				and	tibom010.cpha = tcyesno.yes
				and	( tibom010.exdt=0 or tibom010.exdt > date.num() )
				selectdo
					bom.qty.per.set = fant1.quan * tibom010.qana
					order.mitm	= fant1.mitm
					select timrp020.item,timrp020.oqan
					from	timrp020
					where	timrp020._index2 = {:order.mitm}
					and	timrp020._index3 <= {:stdt.t}

					selectdo
						reqd.qty      = reqd.qty + (timrp020.oqan * bom.qty.per.set)
					endselect

					select timps520.item,timps520.oqan
					from	timps520
					where	timps520._index3  = {:order.mitm}
					and	timps520._index2 <= {:stdt.t}
					selectdo
						reqd.qty      = reqd.qty + (timps520.oqan * bom.qty.per.set)
					endselect
				selectempty
					bom.qty.per.set = tibom010.qana
					order.mitm	= tibom010.mitm
					select timrp020.item,timrp020.oqan
					from	timrp020
					where	timrp020._index2 = {:order.mitm}
					and	timrp020._index3 <= {:stdt.t}
					selectdo
						reqd.qty      = reqd.qty + (timrp020.oqan * bom.qty.per.set)
					endselect

					select timps520.item,timps520.oqan
					from	timps520
					where	timps520._index3  = {:order.mitm}
					and	timps520._index2 <= {:stdt.t}
					selectdo
						reqd.qty      = reqd.qty + (timps520.oqan * bom.qty.per.set)
					endselect
				endselect
			endselect
			select 	ticst001.subd,ticst001.issu,tcmcs003.cwar
			from	ticst001,tcmcs003
			where	ticst001._index3 = {:tibom010.sitm}
			and  	( ticst001.subd > 0 or ticst001.issu > 0 )
			and	ticst001.cwar refers to tcmcs003
			and	tcmcs003.nwrh=tcyesno.yes
			selectdo
				reqd.qty = reqd.qty + ticst001.subd + ticst001.issu	
			endselect
			qty.on.hand = 0
			qty.on.order= 0
			safety.stock= 0
			select tdinv001.stoc,tdinv001.sfst,tdinv001.ordr,tcmcs003.cwar
			from	tdinv001, tcmcs003
			where	tdinv001._index2 = {:tibom010.sitm}
			and	tdinv001.cwar refers to tcmcs003
			and	tcmcs003.nwrh=tcyesno.yes
			selectdo
				qty.on.hand = qty.on.hand + tdinv001.stoc
				safety.stock= safety.stock+ tdinv001.sfst
|				qty.on.order= qty.on.order+ tdinv001.ordr

			endselect
			select tdinv150.qana
			from	tdinv150
			where	tdinv150._index2 = {:tibom010.sitm}
			and	tdinv150._index1 = {tckoor.act.pur}
			and	tdinv150.kotr    = tckotr.receipt
			selectdo
				qty.on.order= qty.on.order+ tdinv150.qana
			endselect				
				rprt_send()
			reqd.qty = 0
		else
			n=n+1
			next(1,n) = bom.sitm
		endif
	endselect

}
Reply With Quote
  #7  
Old 28th January 2003, 21:08
NPRao's Avatar
NPRao NPRao is offline
Guru
 
Join Date: Aug 2001
Location: Pacific NW, USA
Posts: 3,028
NPRao will become famous soon enough
Baan: iBaanERP-5.2a(Reger),SSA-ERP-LN-6.1,Infor LN-10.x - DB: Oracle-10g,11g,12c,MS-SQL - OS: HP-UX, Linux, Windows
Amarpreet,

You can please the appl.delete() function in the after.program or choice.end.program sections so that the lock is removed when the session is exited. Also you need to call that function if only the owner of the local is same as the current login which is executing the session.

Also,

Quote:
This works good while testing but sometimes application locks created by users are not automatically deleted even after user clos all the session & even
BaaN standard program removes the application locks during a proper logoff process. If its an abnormal exit/loss of network connection etc, then the locks have to be manually deleted from the application locks session, ttadv9598m000.
__________________
The art of perfection does not lie in doing extraordinary things but, doing ordinary things extraordinarily well. [-N. Prashanth Rao]
How To Ask Questions The Smart Way,BaaNBoard,NPRao
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Running session without user intervention mprakash Tools Development 1 30th August 2004 06:53
Not authorized to run as user baan positive Tools Administration & Installation 7 29th June 2004 08:56
Session will not run as a job pjohns Tools Administration & Installation 9 17th January 2003 13:10


All times are GMT +2. The time now is 13:33.


©2001-2017 - Baanboard.com - Baanforums.com