IndoTech
28th March 2013, 11:17
Hi,

below is the logic used to update SO lines with a Wrh value on SO header
after rewrite the header record but it is not working, can anyone check and resolve. thanks

function update.wrh.to.lines(domain tcorno ord, domain tccwar v.cwar)
{

domain tcpono a.pono(1,1) based
long pos.cnt, i

pos.cnt = 0
select tdsls041.* from tdsls041
where tdsls041._index1 ={:ord}
selectdo
pos.cnt = pos.cnt + 1
alloc.mem(a.pono, 1,pos.cnt)
a.pono(1,pos.cnt) = tdsls041.pono

endselect

if pos.cnt > 0 then

for i = 1 to pos.cnt

stpapi.handle.subproc ("tdsls4102s000", "mtdsls000090451", "10")
stpapi.put.field("tdsls4102s000","tdsls041.orno",str$(ord))
stpapi.put.field("tdsls4102s000","tdsls041.pono",str$(a.pono(1,i)))

ret = stpapi.find("tdsls4102s000",error)
if ret = 1 then
stpapi.put.field("tdsls4102s000","tdsls041.cwar",v.cwar)

ret1 = stpapi.update("tdsls4102s000",1,error)

if ret1 <> 1 then
ret = stpapi.recover("tdsls4102s000",error)
endif
stpapi.end.session("tdsls4102s000")
endif
stpapi.end.session("tdsls4102s000")
endfor
endif
free.mem(a.pono)
}

Kedar

mark_h
28th March 2013, 15:06
This is the correct forum for AFS questions. Next search this forum for tdsls4102s000 - you will see a lot of posts around it. Here is just one of many (http://www.baanboard.com/baanboard/showthread.php?t=15329&highlight=tdslsl102s002). I won't be of much help since we do not use these on our 4c4 system.

IndoTech
29th March 2013, 09:12
Hi,

below is the logic used to update SO lines with a Wrh value on SO header
after rewrite the header record but it is not working, can anyone check and resolve. thanks

function update.wrh.to.lines(domain tcorno ord, domain tccwar v.cwar)
{

domain tcpono a.pono(1,1) based
long pos.cnt, i

pos.cnt = 0
select tdsls041.* from tdsls041
where tdsls041._index1 ={:ord}
selectdo
pos.cnt = pos.cnt + 1
alloc.mem(a.pono, 1,pos.cnt)
a.pono(1,pos.cnt) = tdsls041.pono

endselect

if pos.cnt > 0 then

for i = 1 to pos.cnt

stpapi.handle.subproc ("tdsls4102s000", "mtdsls000090451", "10")
stpapi.put.field("tdsls4102s000","tdsls041.orno",str$(ord))
stpapi.put.field("tdsls4102s000","tdsls041.pono",str$(a.pono(1,i)))

ret = stpapi.find("tdsls4102s000",error)
if ret = 1 then
stpapi.put.field("tdsls4102s000","tdsls041.cwar",v.cwar)

ret1 = stpapi.update("tdsls4102s000",1,error)

if ret1 <> 1 then
ret = stpapi.recover("tdsls4102s000",error)
endif
stpapi.end.session("tdsls4102s000")
endif
stpapi.end.session("tdsls4102s000")
endfor
endif
free.mem(a.pono)
}

Kedar

Is It possible to update SO lines from SO header using AFS?

mark_h
29th March 2013, 18:45
Based off the other threads I think it is possible. How it works on your system with your sessions I do not know.

IndoTech
31st March 2013, 14:15
Hi
stpapi.put.field("tdsls4102s000","tdsls041.cwar",v.cwar)

ret1 = stpapi.update("tdsls4102s000",1,error)

here while update the wrh value it shows error as "Lines r being updated by other user"

but no one else is using this session as it is in development, so how i can remove lock and update lines?


kedar.

mark_h
1st April 2013, 17:16
Is this always happening on every record or just one specific record? If it is every record, no matter which one you update then there can be an issue with the session tdsls4102s000 itself. You might also want to post all of you code. I am not familiar enough with these sessions.