hardei
28th November 2007, 13:54
Dear frnds,
I am working on baan 5.i want to update order quantity using afs in sales order lines.But at stpapi.save session gets hanged

please the code and advise me

select tdsls401.*
from tdsls401
where tdsls401.item = :tcibd001.item
and tdsls401.oltp <> tdgen.oltp.total
and tdsls401.oqua <> tdsls401.dqua
and tdsls401.orno = "HFSL71344"
order by tdsls401._index9
selectdo
orno = tdsls401.orno
posi = tdsls401.pono
oamt = tdsls401.oqua + 10
stpapi.put.field("tdsls4501m000","tdsls401.orno",tdsls401.orno)
stpapi.put.field("tdsls4501m000","tdsls401.pono",str$(tdsls401.pono))
stpapi.put.field("tdsls4501m000","tdsls401.sqnb","0")
| ret1 = stpapi.change.view("tdsls4501m000",error)
ret1 = stpapi.mark("tdsls4501m000",error)
ret1 = stpapi.synchronize.dialog("tdsls4501m000","modify",error)
stpapi.put.field("tdsls4101s000","tdsls401.oqua",str$(oamt))
stpapi.handle.subproc("tdsls4101s000","tdpcg0240s000","kill")
ret = stpapi.update("tdsls4101s000",true,error)
| error.code = stpapi.get.mess.code("tdsls4101s000",error)
| if (error.code = "tdsls00010") and (error <> "")then
ret = stpapi.save("tdsls4101s000",save.error)
message("%d",tdsls401.oqua)
| endif
stpapi.end.session("tdsls4101s000")
stpapi.end.session("tdsls4501m000")

mark_h
28th November 2007, 15:04
First search on the sessions involved. This is just a wild ass swag on my part on what I would expect for Baan V.

|Find the order
stpapi.put.field("tdsls4500m000", "tdsls401.orno", m_orno)
ret = stpapi.find("tdsls4500m000", error.msg)
if ret = 1 then
ret = stpapi.mark("tdsls4500m000", error.msg)
if ret = 1 then
stpapi.handle.subproc( "tdsls4500m000","tdsls4501m000", "add" )
stpapi.form.command("tdsls4500m000", 5, "to.lines",error.msg)
suspend(20) | give some time to sessions openning
ret = stpapi.synchronize.dialog("tdsls4501m000", "add", error.msg)
if ret then
stpapi.handle.subproc("tdsls4101s000", "mtdsls00009047","13")

|Find the order and lines
stpapi.put.field( "tdsls4101s000", "tdsls401.orno", m_orno )
stpapi.put.field( "tdsls4101s000", "tdsls401.pono", m_pono )
ret = stpapi.find("tdsls4101s000", error.msg)

stpapi.put.field( "tdsls4101s000", "tdsls401.oqua", str$(m_oqua) )
ret = stpapi.update("tdsls4501m000", true, error.msg)
if not ret then
ret = stpapi.recover("tdsls4501m000", error.msg)
endif
endif
endif
endif

For the two fields I put on tdsls4101s000 I do not know the names so you would have to put the correct form field names to find the correct line. One thread mentioned that the order number for the session is tdsls040, but I do not know. Also none of the threads I reviewed mentioned tdpcg0240s000, so I have no clue about this session. Good Luck!

hardei
28th November 2007, 15:55
session tdpcg0240s000 opens while saving the sales order.

Please see the attached file

Please advise me how to handle this

mark_h
28th November 2007, 16:32
The first thing I notice in the attachment is the question tdsls410101, so I would expect an stpapi.enum.answer before the update. Something stpapi.enum.answer("tdpur4101s000", "tdsls410101",tcyesno.yes) - of course it needs to be the correct domain for the answer you want to provide.

hardei
29th November 2007, 12:59
Thanks Mark for your quick replies.But i think we can not change ordered quantity through AFS.