patwanirav
11th July 2015, 06:03
can anyone provide a code which insert the outbound line for warehouse order type (SFC Manual) and (Project Manual) through DAL, which will works properly in concurrent transaction?
I had written the code for the same, but it is failing in concurrent transaction.
can anyone help for this ?
bpanda
21st July 2015, 09:29
Hi Nirav,
Can you share some details..
If any error message you are getting...?
Can you share your code here?
patwanirav
22nd July 2015, 05:48
Hello Dear..
I had written the below code to insert outbound line through DAL. But when I do the concurrent transaction using this code, it is giving me fatal error "Record locked for table whwmd215".
dal.reset.error.messages(0)
ret = dal.new.object("whinh220")
if ret <> 0 then
dal.get.error.message(o.err.mesg)
if isspace(o.err.mesg) then
o.err.mesg = "Error while creating warehouse order lines"
endif
return(false)
else
dal.set.field("whinh220.oorg", etol(oorg))
dal.set.field("whinh220.orno", orno)
dal.set.field("whinh220.oset", oset)
dal.set.field("whinh220.item", item)
dal.set.field("whinh220.lsel", etol(lsel))
dal.set.field("whinh220.clot", clot)
dal.set.field("whinh220.qoro", qoro)
if oorg = whinh.oorg.project.man then
dal.set.field("whinh220.tspa", "WMR")
dal.set.field("whinh220.tact", "ACT01")
dal.set.field("whinh220.tcco", ticpr007.acpm)
endif
ret = dal.save.object("whinh220", DB.RETRY) |, db.return.rowchanged + db.return.dupl + db.return.error)
endif
saumya
22nd July 2015, 06:43
error is "Record locked for table whwmd215", which is for whwmd215 table. in your code its not there. Can you put whole code.
manish_patel
23rd July 2015, 00:18
ret = dal.save.object("whinh220", DB.RETRY) |, db.return.rowchanged + db.return.dupl + db.return.error)
Is DB.RETRY flag required in dal.save.object() ?
patwanirav
23rd July 2015, 06:00
Dear Saumya,
If you tried this code, then you will able to get this error. In DAL of whinh220, there are several tables updated and modified. Whwmd215 is one of those table and on which I am getting table locked error or record changed after delayed lock error.
Dear Manish,
I had used db.retry bcoz I am getting record changed after delayed lock error while doing concurrent transaction. Hence I had used the db.retry to overcome this error. Sometime it works for the concurrent transaction, but sometime fails.
Any kind of help is appreciated. Thanks in advance. :)
bhushanchanda
23rd July 2015, 14:36
Hi,
Make sure you are reading table whinh200 every time, before creating a new record in whinh220. Try creating the order manually. Make sure its not creating new set. If the item data differs, it may create a new set and wont allow you to add the order in same order set.
Here's a working script.
select whinh200.*
from whinh200
where whinh200._index1={:i.oorg,:i.orno}
selectdo
endselect
db.store.record(twhinh200)
dal.new.object("whinh220")
dal.set.field("whinh220.oorg",i.oorg)
dal.set.field("whinh220.orno",i.orno)
dal.set.field("whinh220.pono",i.pono)
dal.set.field("whinh220.seqn",i.seqn)
dal.set.field("whinh220.oset",1)
dal.set.field("whinh220.cwar",i.sfco)
dal.set.field("whinh220.comp",i.sfcp)
dal.set.field("whinh220.item",i.sitm)
dal.set.field("whinh220.qoro",i.qord)
dal.set.field("whinh220.qord",i.qord)
dal.set.field("whinh220.qoor",i.qord)
dal.set.field("whinh220.hstq",tchstp.no)
dal.set.field("whinh220.refe",i.rodr&"/"&str$(i.pono))
ret = dal.save.object("whinh220")
if ret = 0 then
commit.transaction()
| Created successfully
else
abort.transaction()
| Failed
endif
You might not need db.retry. You can add db.retry.point() before dal.new.object()
I doubt, there might be some problem with the item. I will suggest to first try and create the order manually. Also, debugging is the best way to point out the error.
patwanirav
28th July 2015, 06:20
Hi Bhushan,
the code you had suggested is not working in concurrent transaction, giving fatal error 201 (Record changed after delayed lock).
bhushanchanda
28th July 2015, 09:34
Hi,
If possible, post your complete code. That will help to understand the issue better.
mubarak
16th June 2020, 23:19
fatal error tisfc0120m000 in DLL. owhinh220.