balugr
13th August 2002, 12:20
Hi

I am trying to automate "Maintain Receipts" using AFS. The session hangs at the after the line - stpapi.handle.subproc( "tdpur4120m000", "tdilc4113s000", "send"). We are using Baan IVc4 with multi currency and lot control.

Start baan code:

|******************************************************************************
|* tdbardll0001 0 VRC B40C c4 umcr
|* AFS to Upload Purchase Receipt
|* omnibz
|* 12-08-02 [17:26]
|******************************************************************************
|* Script Type: Library
|******************************************************************************
#pragma used dll ottstpapihand

function extern use.afs.to.upload.receipts()
{
table ttdbar003
table ttdbar004
table ttdpur041
table ttdpur045

extern domain tcrcno reno
string err(50)
long ret.code

select tdbar003.*
from tdbar003
where tdbar003.stat = tdsls.lsta.free
order by tdbar003._index1
selectdo
stpapi.put.field("tdpur4120m000", "tdpur045.reno", str$(reno))
stpapi.put.field("tdpur4120m000", "form.dino", tdbar003.dino)
stpapi.put.field("tdpur4120m000", "tdpur045.orno", str$(tdbar003.orno))
stpapi.put.field("tdpur4120m000", "tdpur045.pono", str$(tdbar003.pono))
stpapi.put.field("tdpur4120m000", "tdpur045.diqu", str$(tdbar003.dqua))
stpapi.put.field("tdpur4120m000", "tdpur045.date", str$(tdbar003.ddtb))
stpapi.handle.subproc( "tdpur4120m000", "tdilc4113s000", "send")
select tdbar004.*
from tdbar004
where tdbar004._index1 = {:tdbar003.orno, :tdbar003.pono}
order by tdbar004._index1
selectdo
select tdpur041.*
from tdpur041
where tdpur041._index1 = {:tdbar003.orno, :tdbar003.pono}
selectdo
endselect
stpapi.put.field("tdilc4113s000", "tdilc402.clot", tdbar004.clot) ====> Session hangs here
stpapi.zoom.option("tdilc4113s000", 1, "tdltc0101s000", err)
stpapi.put.field("tdltc0101s000", "tdltc001.clot", tdbar004.clot)
stpapi.put.field("tdltc0101s000", "tdltc001.lsup", num.to.date$(tdbar004.dcod, 1))
stpapi.put.field("tdltc0101s000", "tdltc001.oudt", str$(tdbar003.ddtb))
stpapi.update("tdlc0101s000", 1, err)
stpapi.end.session("tdlc0101s000")
stpapi.put.field("tdilc4113s000", "tdilc402.date", str$(tdbar003.ddtb))
stpapi.put.field("tdilc4113s000", "tdilc402.stun", tdpur041.cuqp)
stpapi.put.field("tdilc4113s000", "tdilc402.qstr", str$(tdbar004.rqty))
selecteos
stpapi.update("tdilc4113s000", 1, err)
stpapi.end.session("tdilc4113s000")
endselect
stpapi.update("tdpur4120m000", true, err)
selecteos
stpapi.end.session("tdpur4120m000")
endselect
}


Any help is greatly appreciated.

klesch
13th August 2002, 13:39
Try using "add" instead of "send".

Satish Nandeti
13th August 2002, 13:59
Instead of giving the statement stpapi.handle.subproc( "tdpur4120m000", "tdilc4113s000", "send"), try with following statement
stpapi.handle.subproc( "tdpur4120m000", "tdilc4113s000", "add").

mark_h
13th August 2002, 15:42
Actually it looks like if change the "send" to "add" you will also need a continue or save to activate the "tdilc4113s000" session. So it would look something like this:


stpapi.handle.subproc( "tdpur4120m000", "tdilc4113s000", "send")
stpapi.continue.process("tdpur4120m000",msg)


You would need what ever command(save,continue, etc.) that activated the tdpur4113s000 sub-session.

Good Luck!

Mark

balugr
14th August 2002, 06:50
Hi All

Thanks a lot for responding. I tried to use "add" but it didn't work.

Mark - I will include

code: baan

stpapi.continue.process("tdpur4120m000",msg)

and get back to you.

Bye

Bala

mark_h
14th August 2002, 15:31
My appologies. This is what I meant to post.


stpapi.handle.subproc( "tdpur4120m000", "tdilc4113s000", "add")
stpapi.continue.process("tdpur4120m000",msg)


This is what happens when you cut and paste. Now that I look at the session you would probably do a insert or a save. Not a continue. Search through the tools forum there should be some other posts on this session. Always remember that this method is to emulate what happens when you run the session manually.

Good Luck!

Mark

balugr
15th August 2002, 07:13
Hi Mark

Thanks for your reply.

So far I didn't have success. I am going on a short vacation next week, will come back and dig deaper.

Bye

Bala

FoxZapper
22nd November 2003, 11:52
Hello Bala,

Did you figure it out?
I had the same problem for tdilc4113s000, but this was in the Maintain Replenishment Receipts (tdrpl0122m000) session.

Dennis had a similar problem. And I had a workaround to esnure that tdilc4113s000 did not pop up.
http://www.baanboard.com/baanboard/showthread.php?s=&threadid=7511&perpage=15&display=&pagenumber=2

Were you able to solve this situation? Does the session continue to hang?

Regards,

DStroud
26th November 2003, 18:20
Bala,

I looked at your code and based on where you indicated that you had a problem. I think that your problem is that you need to create the Lot Number in tdltc0101s000 before doing the put in tdilc402.clot. I think that you are getting a “Not Found” error.


Doug