raikar_raviraj
7th August 2007, 13:02
Hi,

I am trying to create Receipt for both lot and without lot controlled item. AFS works fine for without lot controlled Item. But in case of lot controlled item, it inserts the record properly in tdilc4113s000 for the first item.

But when i try to end the session to insert another lot controlled item.. the session tdilc4113s000 doesnt end.. instead 2 objects get invoked tfgld4200 and tfgld1201. I am not able to figure out why this objects are getting invoked..

The script which i wrote is as below


select ltlnt041.*
from ltlnt041
where ltlnt041._index1 = {:import.orno}
and ltlnt041.chall = :chall
and (ltlnt041.oqua - ltlnt041.dqua)>0
selectdo
if etol(ltlnt041.chck) = 1 then
stpapi.put.field("tdpur4120m000", "tdpur045.diqu", str$(ltlnt041.pqua))
stpapi.put.field("tdpur4120m000", "tdpur045.date", str$(date.num()))
if etol(ltlnt041.kltc) <> 1 then
stpapi.put.field("tdpur4120m000", "tdpur045.dqua", str$(ltlnt041.rqua))
endif
stpapi.enum.answer("tdpur4120m000", "tdind00008", tcyesno.yes)
ret = stpapi.update("tdpur4120m000",1,err)
stpapi.handle.subproc( "tdpur4120m000", "tdilc4113s000", "add")
if etol(ltlnt041.kltc) = 1 then
stpapi.put.field("tdilc4113s000","tdilc402.item",ltlnt041.item)
stpapi.put.field("tdilc4113s000","tdilc402.clot",ltlnt041.clot)
stpapi.put.field("tdilc4113s000","tdilc402.date",str$(date.num()))
get.storage.unit()
stpapi.put.field("tdilc4113s000","tdilc402.stun",tdpur041.cuqp)
stpapi.enum.answer("tdilc4113s000", "tdind41131", tcyesno.yes)
ret = stpapi.insert("tdilc4113s000",1,err)
stpapi.end.session("tdilc4113s000") | when i try to end this session
| two objects get activated
| tfgld4200 & tfgld1201
endif
endif
endselect
stpapi.get.field("tdpur4120m000", "tdpur045.reno", rcptno)
stpapi.end.session("tdpur4120m000")


please tell me where im going wrong.

Regards

Raviraj

mark_h
7th August 2007, 14:42
For starters, switch these two lines from this:

ret = stpapi.update("tdpur4120m000",1,err)
stpapi.handle.subproc( "tdpur4120m000", "tdilc4113s000", "add")
to this:

stpapi.handle.subproc( "tdpur4120m000", "tdilc4113s000", "add")
ret = stpapi.update("tdpur4120m000",1,err)
The handle subproc has to come before the session is activated.

raikar_raviraj
8th August 2007, 05:48
Hi Mark,

I switched the two lines but to no avail. Problem is that the child session doesnt get terminated by.

stpapi.end.session("tdilc4113s000")


Infact when AFS encounters this line of code, it invokes the two objects tfgld1201 and tfgld4200.

I also tried putting the above stpapi command outside the select statement but it isnt working in that case either..

mark_h
8th August 2007, 14:20
Just changing those two lines were the first step. Next I recommend search and reading other threads (http://www.baanboard.com/baanboard/showthread.php?s=&threadid=7511&perpage=15&display=&pagenumber=2). This one talks about boi.call. You can search on tdilc4113s000. Do you have source for tdpur4120m000 and tdilc4113s000?

Also do not forget to read my signature about latest stpapi patches and lastest session object.