zhgello
9th June 2009, 22:40
Hello,
My aim for this session is to generate a report and, afterward, change values of 2 fields on 2 different tables.
The problem with this is that I believe one of my two SELECT statements is unlocking the record from the other one.
Running the script results in error message:
Error 206 (Record is not locked) on tdsls989400 in db_update(51)
Can no continue in tdslso490m222
I've seen all the posts in this forum for Error 206 and I think I have a general understanding of the problem.
But I do not know how I can accomplish my goal of running this session and updating those 2 tables.
Does anyone have a suggestion?
I have included the script.
Am using Baan IVc4
Thank You.
|******************************************************************************
|* tdslso490
|* Shipment Notification
|******************************************************************************
|* Main table tdsls990 Tracking Number table
|******************************************************************************
|****************************** declaration section ***************************
declaration:
table ttdsls990 | Tracking Number
table ttdsls989 | Shipping Address
table ttdsls045 | Sales Deliveries
table ttiitm001 | Items
table ttccom990 | Customer Contacts
table ttdsls993 | Fax & e-mail Info
table ttdsls040 | Sales Orders
table ttdsls994 | Route Table
long pick | Variable for Pick List
extern domain tcedi.prnt pkno.f fixed
extern domain tcedi.prnt pkno.t fixed
extern domain tcnamb trac.f fixed
extern domain tcnamb trac.t fixed
long save.pkno
long first.time
domain tcnamb save.trac
long stat.val
|****************************** form section **********************************
form.1:
init.form:
get.screen.defaults()
|****************************** choice section ********************************
choice.cont.process:
on.choice:
execute(print.data)
choice.print.data:
on.choice:
if rprt_open()
then
first.time = 0
save.pkno = 0
save.trac = " "
shipment.notification()
rprt_close()
else
choice.again()
endiF
|****************************** field section *********************************
field.pkno.f:
when.field.changes:
pkno.t = pkno.f
field.trac.f:
when.field.changes:
trac.t = trac.f
|****************************** function section ******************************
functions:
function shipment.notification()
{
db.retry.point()
select tdsls990.*
from tdsls990 for update
where tdsls990.stat = 4 and |Status is 'Ready'
tdsls990._index1 inrange {:pkno.f, :trac.f}
and {:pkno.t, :trac.t}
order by tdsls990._index1
selectdo
pick = lval(tdsls990.pkno)
if first.time = 0 then
save.pkno = pick
save.trac = tdsls990.trac
first.time = 1
else
if save.pkno = pick and save.trac <> tdsls990.trac then
save.trac = " "
else
save.pkno = pick
save.trac = tdsls990.trac
endif
endif
if save.pkno = pick and save.trac = tdsls990.trac then
select
tdsls989.*,
tdsls993.*,
tdsls994.*,
tdsls040.orno, tdsls040.cuno, tdsls040.shcono, tdsls040.crte,
tccom990.cuno, tccom990.cono, tccom990.nama, tccom990.namb,
tdsls045.*,
tiitm001.item, tiitm001.dsca, tiitm001.cuqs
from tdsls989 for update, tdsls993, tdsls994, tdsls040, tccom990, tdsls045, tiitm001
where tdsls989.pino = :pick
and tdsls989.shnt = 2 |So far, no other notifications have been sent.
and tdsls993.orno = tdsls989.orno
and tdsls993.kfrm = 1
and tdsls993.shpnt = 1
and tdsls040.orno = tdsls993.orno
and tdsls994.crte = tdsls040.crte
and tccom990.cuno = tdsls040.cuno
and tccom990.cono = tdsls040.shcono
and tdsls045.orno = tdsls993.orno
and tdsls045.pino = :pick
and tiitm001.item = tdsls045.item
selectdo
tdsls990.stat = tdstat.sent1 |Change status from 'Ready' to 'Sent 1st Report'
db.update(ttdsls990, db.retry) |*** THIS IS WHERE THE PROGRAM BOMBS***
commit.transaction()
tdsls989.shnt = tcyesno.yes |Change status from 'Sent Report? 'No' to 'Yes'
db.update(ttdsls989, db.retry) |*** THIS IS ALSO WHERE THE PROGRAM BOMBS***
commit.transaction()
rprt_send()
endselect
endif
endselect
}
My aim for this session is to generate a report and, afterward, change values of 2 fields on 2 different tables.
The problem with this is that I believe one of my two SELECT statements is unlocking the record from the other one.
Running the script results in error message:
Error 206 (Record is not locked) on tdsls989400 in db_update(51)
Can no continue in tdslso490m222
I've seen all the posts in this forum for Error 206 and I think I have a general understanding of the problem.
But I do not know how I can accomplish my goal of running this session and updating those 2 tables.
Does anyone have a suggestion?
I have included the script.
Am using Baan IVc4
Thank You.
|******************************************************************************
|* tdslso490
|* Shipment Notification
|******************************************************************************
|* Main table tdsls990 Tracking Number table
|******************************************************************************
|****************************** declaration section ***************************
declaration:
table ttdsls990 | Tracking Number
table ttdsls989 | Shipping Address
table ttdsls045 | Sales Deliveries
table ttiitm001 | Items
table ttccom990 | Customer Contacts
table ttdsls993 | Fax & e-mail Info
table ttdsls040 | Sales Orders
table ttdsls994 | Route Table
long pick | Variable for Pick List
extern domain tcedi.prnt pkno.f fixed
extern domain tcedi.prnt pkno.t fixed
extern domain tcnamb trac.f fixed
extern domain tcnamb trac.t fixed
long save.pkno
long first.time
domain tcnamb save.trac
long stat.val
|****************************** form section **********************************
form.1:
init.form:
get.screen.defaults()
|****************************** choice section ********************************
choice.cont.process:
on.choice:
execute(print.data)
choice.print.data:
on.choice:
if rprt_open()
then
first.time = 0
save.pkno = 0
save.trac = " "
shipment.notification()
rprt_close()
else
choice.again()
endiF
|****************************** field section *********************************
field.pkno.f:
when.field.changes:
pkno.t = pkno.f
field.trac.f:
when.field.changes:
trac.t = trac.f
|****************************** function section ******************************
functions:
function shipment.notification()
{
db.retry.point()
select tdsls990.*
from tdsls990 for update
where tdsls990.stat = 4 and |Status is 'Ready'
tdsls990._index1 inrange {:pkno.f, :trac.f}
and {:pkno.t, :trac.t}
order by tdsls990._index1
selectdo
pick = lval(tdsls990.pkno)
if first.time = 0 then
save.pkno = pick
save.trac = tdsls990.trac
first.time = 1
else
if save.pkno = pick and save.trac <> tdsls990.trac then
save.trac = " "
else
save.pkno = pick
save.trac = tdsls990.trac
endif
endif
if save.pkno = pick and save.trac = tdsls990.trac then
select
tdsls989.*,
tdsls993.*,
tdsls994.*,
tdsls040.orno, tdsls040.cuno, tdsls040.shcono, tdsls040.crte,
tccom990.cuno, tccom990.cono, tccom990.nama, tccom990.namb,
tdsls045.*,
tiitm001.item, tiitm001.dsca, tiitm001.cuqs
from tdsls989 for update, tdsls993, tdsls994, tdsls040, tccom990, tdsls045, tiitm001
where tdsls989.pino = :pick
and tdsls989.shnt = 2 |So far, no other notifications have been sent.
and tdsls993.orno = tdsls989.orno
and tdsls993.kfrm = 1
and tdsls993.shpnt = 1
and tdsls040.orno = tdsls993.orno
and tdsls994.crte = tdsls040.crte
and tccom990.cuno = tdsls040.cuno
and tccom990.cono = tdsls040.shcono
and tdsls045.orno = tdsls993.orno
and tdsls045.pino = :pick
and tiitm001.item = tdsls045.item
selectdo
tdsls990.stat = tdstat.sent1 |Change status from 'Ready' to 'Sent 1st Report'
db.update(ttdsls990, db.retry) |*** THIS IS WHERE THE PROGRAM BOMBS***
commit.transaction()
tdsls989.shnt = tcyesno.yes |Change status from 'Sent Report? 'No' to 'Yes'
db.update(ttdsls989, db.retry) |*** THIS IS ALSO WHERE THE PROGRAM BOMBS***
commit.transaction()
rprt_send()
endselect
endif
endselect
}