vineetu1
6th December 2005, 08:50
I have created the following AFS for delivery of RPL Orders.

The script works extremely slowly i.e. upto 90 seconds per RPL line. The same type of scripts for Sales order delivery works fast (ie. 1 sec / SO line).

I did debug the AFS script and found that the stpapi.find() command for subsequent lines (other than the first) and the stpapi.update() command (for all transactions) takes a lot of time. (approx 40-45 sec per command).

How can the performace be improved ?

function process.maintian.rpl.deliveries()
{
long ret, brp.id
string err.mesg(30)
string delivered.quantity(10), del.date(10), delivery.date(8)
domain tcorno order.no

brp.id = brp.open("rtdsil7451msil1","D",0)

select tdrpl100.*
from tdrpl100
where tdrpl100._index1 inrange {:orno.f} and {:orno.t}
and tdrpl100.dqua = 0
and tdrpl100.srpl = 4
order by tdrpl100._index1
selectdo
output.log = strip$(str$(tdrpl100.orno)) & "-" & strip$(str$(tdrpl100.pono)) & "-" strip$(str$(tdrpl100.srnb))
stpapi.put.field("tdrpl0114m000","tdrpl100.orno",str$(tdrpl100.orno))
stpapi.put.field("tdrpl0114m000","tdrpl100.pono",str$(tdrpl100.pono))
ret = stpapi.find("tdrpl0114m000",err.mesg)
if ret <> 1 then
output.log = output.log & " :- Error - " & strip$(err.mesg)
display("output.log")
brp.ready(brp.id)
else
stpapi.put.field("tdrpl0114m000","tdrpl100.dqua",str$(tdrpl100.oqua))
stpapi.put.field("tdrpl0114m000","tdrpl100.rddt",str$(tdrpl100.pddt))
ret = stpapi.update("tdrpl0114m000",1,err.mesg)
if ret <> 1 then
output.log = output.log & " :- Error - " & strip$(err.mesg)
display("output.log")
brp.ready(brp.id)
else
output.log = output.log & "Delivery successfully done for" & strip$(shiftl$(tdrpl100.item))
output.log = output.log & " Qty : " & strip$(shiftl$(delivered.quantity))
output.log = output.log & " Del. date : " & strip$(shiftl$(del.date))
display("output.log")
brp.ready(brp.id)
endif
endif
selecteos
stpapi.end.session("tdrpl0114m000")
brp.close(brp.id)
selectempty
output.log = "No data in range"
brp.close(brp.id)
endselect
}

mark_h
6th December 2005, 15:23
Have you tried ending the session each time? One I just did recently worked better when I closed the session each time, but it still was not taking 45 seconds. Do you have source so that you can see what tdrpl0114m000 is doing? You code looks okay, but you never know how some sessions will work and how they will react being left open.

vineetu1
7th December 2005, 08:25
No I do not have the source code. From where can I get one ??

I will try the option of closing the session after each line.

mark_h
7th December 2005, 14:17
You would need to ask Baan for the code. I would probably just go ahead and log a case with them. They may already have a fix.

günther
11th July 2006, 15:22
Vineet,

I just tried your code on my system and was not successful. I guess it's because on your system tdrpl000.ened must be set to tdrpl.ened.orno (i.e. maintain deliveries by order number) while on my system tdrpl000.ened is set to tdrpl.ened.pino (i.e. maintan delivieres by pickup number).

So could you please have a check on your current tdrpl000.ened setting?
Thanks.

Btw. Don't get confused. My question has nothing to do with your problem.

Günther