Question

CUSTOM EVENT : error during execution of trigger

  • 23 August 2023
  • 8 replies
  • 154 views

Userlevel 1
Badge +8

Hello everyone , 

I created a cutom event to trigger and error if the amounts don’t match in customer order ( screeshot below ) when creating a new CO  : 

 

But I get this error when I try to insert a new customer order line : 

 

Does anyone know the root of the problem and how to resolve it .

 

Thank you in advance 

Hanane

 


8 replies

Userlevel 2
Badge +9

Hello, the error is 

table IFSAPP.CUSTOMER_ORDER_LINE_TAB is mutating

while a sql record is being modified from CUSTOMER_ORDER_LINE_TAB, you cannot access to the table the easiest solution would be to create a custom procedure and run it as a deferred call.

Exemple :

DECLARE

v_rowkey VARCHAR2(32000):='&NEW:ROWKEY';

attr_ VARCHAR2(32000);

BEGIN

  Client_SYS.Clear_Attr(attr_);

  Client_SYS.Add_To_Attr('P_ROWKEY',v_rowkey , attr_);

  transaction_sys.deferred_call('MyCustomPackage_API.MyCustomProcedure','PARAMETER',attr_ ,'Comment of what my custom procedure does');

END;

Userlevel 1
Badge +8

Thank you for the reply .

I used this syntax instead , it seemed easier : 

 

DECLARE

 PRAGMA AUTONOMOUS_TRANSACTION;
 amount_1_  number :=0 ;
 amount_2_  number :=0 ;

BEGIN


amount_1_  := ROUND((&NEW:BUY_QTY_DUE * &NEW:SALE_UNIT_PRICE * (1-(&NEW:DISCOUNT/100)) ),2) ;
amount_2_  := (&NEW:BUY_QTY_DUE * ROUND(&NEW:SALE_UNIT_PRICE * (1-(&NEW:DISCOUNT/100)) , 2)) ;

IF (amount_1_ <> amount_2_ ) THEN

  IFSAPP.Error_SYS.Appl_General('', 'Wrong Amount ! ') ;


END IF ;

END;

 

I don’t get any error now , but also nothing happens ( no error is displayed ) , do you possibily an idea why ? 

 

KR,

Hanane

Userlevel 1
Badge +8

I tried also this : IFSAPP.Error_SYS.Record_General('CustomerOrderLine', 'COERR:Wrong Amount ! ') ;

but no luck ! 

Userlevel 2
Badge +9

If you try instead :
 

IF (amount_1_ <> amount_2_ ) THEN

  IFSAPP.Error_SYS.Appl_General('', 'Wrong Amount ! ') ;

ELSE

  IFSAPP.Error_SYS.Appl_General('', 'Correct amount ') ;
END IF ;

 

can you see the displayed message? otherwise, can you send a screenshot of your event?

Userlevel 2
Badge +9

you can also replace

IF (amount_1_ <> amount_2_ ) THEN

by

IF (amount_1_ != amount_2_ ) THEN

Userlevel 1
Badge +8

I have this error when adding the second part of IF condition : 

 

this line is the problem :  IFSAPP.Error_SYS.Appl_General('', 'Wrong Amount ! ') ;

Userlevel 2
Badge +9

There is a post about this error you are facing

Oracle 'Bad Depth Indicator' error in IFS10 | IFS Community

Userlevel 1
Badge +8

Thank you , it actually worked within few minutes and then the error reappeared .

I’ll try to discuss this with the DB team .

 

Have a good day ,

Hanane

Reply