cherokee
24th November 2006, 15:46
Hello everyone,

I have a session X that calls session Y on a before input field section of X session as follow:


field.A:
before.input:
zoom.to.y()
.....

function zoom.to.y()
{
if not process.1 then
process.1 = activate("Y")
#pragma used session Y
......
}


I cann't start session Y trought X session's FS. I can successfully call X's FS no problem but how do I do to call/controll session Y?

I have tried this to weak up Y but doesn't work.

....
stpapi.handle.subproc("X","Y","add")
stpapi.put.field("X","A","ABC")
.....



Thanks in advance,

Carlos
:confused:

mark_h
24th November 2006, 17:55
I am not 100% sure, but I think before.input is one of those sections that does not get executed during AFS routine. Is there a reason you have to call session Y? I mean can't you just put the value you need? Are these home grown sessions or standard baan sessions?

cherokee
24th November 2006, 19:42
Mark,

It is a standard BaaN session. I can't change it. It is Mantain Approvals tdpur4121m000 calls tdilc4123s000.

Carlos

mark_h
27th November 2006, 14:48
Sorry it took so long - nice long weekend.

Here is what I do:

| 20050509.st
rc = stpapi.enum.answer("tdpur4121m000","tdilc41230",tcyesno.yes) | 20050509.end
rc = stpapi.enum.answer("tdpur4121m000","tdilc41231",tcyesno.yes)
stpapi.put.field("tdpur4121m000","tdpur045.reno",str$(receipt.number))
stpapi.put.field("tdpur4121m000","tdpur045.orno",str$(purchase.order))
stpapi.put.field("tdpur4121m000","tdpur045.pono",str$(purchase.pono))
rc = stpapi.find("tdpur4121m000",msg)
if not isspace(msg) or rc<>1 then
stpapi.end.session("tdpur4121m000")
return
endif


stpapi.handle.subproc("tdpur4121m000","tcmcs9551s00b","add")
| 072704 Use the purchase order line unit.
if tiitm001.kltc = tckltc.batch or conversion.factor<> 1.0 or purchase.unit <> tiitm001.stgu then
stpapi.handle.subproc("tdpur4121m000","tdilc4123s000","add")
stpapi.put.field("tdpur4121m000","tdpur045.quap",str$(appr.qty))
rc = stpapi.update("tdpur4121m000",1,msg)

stpapi.put.field("tdilc4123s000","tdilc111.stra",str$(appr.qty))
| 20050615.st Use reject not back order qty.
|stpapi.put.field("tdilc4123s000","tdilc111.strd",str$(backorder.qty))
stpapi.put.field("tdilc4123s000","tdilc111.strd",str$(rej.qty)) |20050615.end
stpapi.put.field("tdilc4123s000","tdilc111.stka",str$(appr.qty))
| 20050615.st
| stpapi.put.field("tdilc4123s000","tdilc111.stkd",str$(backorder.qty))
stpapi.put.field("tdilc4123s000","tdilc111.stkd",str$(rej.qty)) |20050615.end
rc = stpapi.update("tdilc4123s000",1,msg)
else
............
endif

No promises this will work for you, but this is what I do to handle tdilc4123m00.

cherokee
28th November 2006, 19:53
Mark,

thanks again. I tried and yes, session tdilc4123s000 opens but when I try the update it, it returns an error message "Session not available" the ret value is 0. Below here is my test code. So, the subsession does not get updated.



stpapi.put.field("tdpur4121m000","tdpur045.reno",str$(709911))
stpapi.put.field("tdpur4121m000","tdpur045.orno",str$(170374))
stpapi.put.field("tdpur4121m000","tdpur045.pono",str$(12))
if stpapi.find("tdpur4121m000") = 1 then
stpapi.handle.subproc("tdpur4121m000","tdilc4123s000","add")
stpapi.get.field("tdpur4121m000","tdpur045.dqua",acc.qty)
stpapi.put.field("tdpur4121m000","tdpur045.quap",acc.qty)
ret = stpapi.update("tdpur4121m000",1,error.mess)
if isspace(error.mess) then
stpapi.put.field("tdilc4123s000","tdilc111.stra",acc.qty)
stpapi.put.field("tdilc4123s000","tdilc111.strd","0")
stpapi.put.field("tdilc4123s000","tdilc111.stka",acc.qty)
stpapi.put.field("tdilc4123s000","tdilc111.stkd","0")
ret = stpapi.update("tdpur4123s000",1,error.mess) |<- returns error message "session not available"
if not isspace(error.mess) then .....



thanks in advance again.

Carlos

mark_h
29th November 2006, 15:03
You might need new objects. I designed this in 4c3 and migrated it to 4c4. I know I did this in tdpur4121m000 using qkey for lot controlled items.


field.tdpur045.quap:
before.input:
| 20050617.st - Make sure records are exported
if api.mode then
export("rcd.ttccom000", rcd.ttccom000)
export("rcd.ttdpur040", rcd.ttdpur040)
export("rcd.ttdpur041", rcd.ttdpur041)
export("rcd.ttdpur045", rcd.ttdpur045)
export("rcd.ttcmcs042", rcd.ttcmcs042)
endif | 20050617.end
|#call
|#pobj added by QKEY 3.70
_pobj_exe1("before.input.tdpur045.quap")
|#end add by QKEY

crdeshpande
1st December 2006, 05:22
You can try

boi.call = "tdboidll500013.create"
export("boi.call",boi.call)

but again this may not work for you , there is small glitch in session tdilc4123s00 , script problem is processnr.pur4121 does not import correct PID of parent in api mode , and there are some variable based which will not get imported correctly from paraent session in FS. This is the reason afs for tdilc4123s000 always fail.

Hope this clarifies.

all the best , Cheers

cherokee
5th December 2006, 17:13
Mark,

I have tried with this..

field.tdpur045.quap:
before.input:
if api.mode then
export("rcd.ttccom000", rcd.ttccom000)
export("rcd.ttdpur040", rcd.ttdpur040)
export("rcd.ttdpur041", rcd.ttdpur041)
export("rcd.ttdpur045", rcd.ttdpur045)
export("rcd.ttcmcs042", rcd.ttcmcs042)
endif | 20050617


does not work. The session still returning the same error "Session not Available".

crdeshpande,

what this code will do? where should I put it. Before calling the api functions?

boi.call = "tdboidll500013.create"
export("boi.call",boi.call)


Thanks,

Carlos

mark_h
5th December 2006, 17:33
You do the boi.call before the calls to the sessions. I actually do this boi.call = "tdboidll0011.Create" before the code I posted above. Different versions I think require different calls. When we put in service pack 18(or 19) of 4c4 some of the calls were different.

mark_h
5th December 2006, 17:40
MY bad - that call I use was actually is used before tdpur4120m000 not tdpur4121m000.

Can you put tdpur4121m000 and tdpur4123s000 in debug mode to see if the rc = stpapi.update("tdpur4121m000",1,msg) actually launches tdpur4123s000?

In your case have you tried rc = stpapi.update("tdpur4121m000",0,msg) with a save afterwards? Sometimes a different set of calls does what you are looking for. Just a thought.

kokchuan
21st June 2007, 04:57
Hi Cherokee

Do you get the solution? actually the infor have identify this issue in solution 208376 and 202758.

but if you have only lower service pack install then you will have problem to install other pre-requisition patch or solution.

Anyone have idea how to address it?

thx