Urgent probleme plz help me

schafik007

New Member
have a customise table for allocation (xxx_det) and I have to update this table by any allocated qte wich depend of total allocated qte and qte on hand of inventory :

for this i have :

/*Calculate on hand quantite */
for each ld_det no-lock where () :
assign l_qte_oh = l_qte_oh + ld_qte_oh .
end.

/*Calculate total allocated quantite*/
for each xxx_det no-lock where ():
l_qte_alloc = l_qte_alloc + xxx_qte_alloc .
end.

message "total qte allocated is " + string(l_qte_alloc) .
pause .
find first xxx_det where () no-error.
if avail xxx_det then
assign ...
XXX_qte_oh = l_qte_oh
xxx_qte_alloc = l_qte_oh - l_qte_alloc .
/*end of program*/

The probleme is between red line and the and of program if an other program allocate or any inventory transaction done => i store on xxx_det wrong information ? HOW CAN I RESOLVE THIS PLZ ?
by locking ld_det and xxx_det until finish traitement ?
 

kaustav_tutun

New Member
try this:
DISABLE TRIGGERS FOR LOAD OF xxx_det.
for each xxx_det no-lock where ():
l_qte_alloc = l_qte_alloc + xxx_qte_alloc .
end.

message "total qte allocated is " + string(l_qte_alloc) .
pause .
find first xxx_det where () no-error.
if avail xxx_det then
assign ...
XXX_qte_oh = l_qte_oh
xxx_qte_alloc = l_qte_oh - l_qte_alloc .
/*end of program*/
 
Top