Alvinlee
3rd February 2007, 15:01
Dear All

I write a script for calling application function server to do sales order line updating by batch.

However, it prompt out "Editable Synchronized session not start".
So I try to add the below line maked as red color, the result is loop at that line on debug mode.

Grateful if advice the solution to me

Thanks
Alvin
function string Update.Sales.Order(domain tcorno vd.orno,
domain tcpono vd.pono,
domain tcpono vd.sqnb,
domain tcqsl1 vd.qty)
{ long ln.flag.found, ln.flag
string ls.Error(1000), ls.Recover(1000)
stpapi.clear("tdsls4100m900")
stpapi.clear("tdsls4101m000")
stpapi.put.field("tdsls4100m900", "tdsls400.orno", vd.orno)
ln.flag.found = stpapi.find("tdsls4100m900" , ls.Error)
if ln.flag.found then
ln.flag = stpapi.synchronize.dialog("tdsls4100m900","modify", ls.Error)
stpapi.put.field("tdsls4101m000", "tdsls401.orno", vd.orno)
stpapi.put.field("tdsls4101m000", "tdsls401.pono", str$(vd.pono))
ln.flag.found = stpapi.find("tdsls4101m000" , ls.Error)
if ln.flag.found = 1 then
stpapi.put.field("tdsls4101m000", "tdsls401.qoor", str$(vd.qty))
ln.flag = stpapi.update( "tdsls4101m000", true, ls.Error )
if ln.flag <> 1 then
ln.flag = stpapi.recover("tdsls4101m100", ls.Recover)
endif
ls.Error= stpapi.get.error( )
stpapi.end.session( "tdsls4100m900" , ls.Error)
endif
return (ls.Error)
}

mark_h
5th February 2007, 13:30
This is the proper forum for AFS problems. I always recommend a search on the session in question. So see if this post (http://www.baanboard.com/baanboard/showthread.php?t=28812&highlight=tdsls4100m900) helps. There are a couple of others, but I think this one was successful.

It is also my understanding that on LN there are DAL libraries that can be used instead of AFS code. I can not really help with that since I am on 4c4.