Hello, i trying create a event, where after save new record in “Vendor Purchase Item” form, i want modify record based on Part number. But i get ERROR about mutating table. Is there any change i can solved this?
Event settings: runnig only for “new created object” and run “after” and LJ is PurchasePartSupplier and table is PURCHASE_PART_SUPPLIER_TAB.
I read about solving by calling custom procedure and run it as a deferred call, but i dont beleave, that is only one solution.
DECLARE
-- pragma autonomous_transaction;
--info_ varchar2(32000);
info_ VARCHAR2(32000) := NULL;
attr_ varchar2(32000);
PART_NO_ varchar2(32000) :='&NEW:PART_NO';
DES_ varchar2(32000);
BEGIN
FOR rec_ IN ( select pps.part_no, pps.objid, pps.objversion
from PURCHASE_PART_SUPPLIER pps
where pps.OBJKEY = '&NEW:ROWKEY')
LOOP
IF (REGEXP_LIKE(SUBSTR(PART_NO_ , 1, 1), 'E(:alpha:]]') AND NOT REGEXP_LIKE(PART_NO_, '-E'))
THEN
Client_Sys.Clear_Attr(attr_);
Client_Sys.Add_To_Attr('RECEIVE_CASE_DB', 'QAINV', attr_);
Client_Sys.Add_To_Attr('INSPECTION_CODE', 'A', attr_);
Client_Sys.Add_To_Attr('SAMPLE_PERCENT', '100', attr_);
IFSAPP.PURCHASE_PART_SUPPLIER_API.Modify__(info_, rec_.objid, rec_.objversion, attr_, 'DO');
ELSE
Client_Sys.Clear_Attr(attr_);
Client_Sys.Add_To_Attr('RECEIVE_CASE_DB', 'INVDIR', attr_);
Client_Sys.Add_To_Attr('INSPECTION_CODE', '', attr_);
Client_Sys.Add_To_Attr('SAMPLE_PERCENT', '0', attr_);
IFSAPP.PURCHASE_PART_SUPPLIER_API.Modify__(info_, rec_.objid, rec_.objversion, attr_, 'DO');
END IF;
END LOOP;
END;
Thanks guys