0 Replies Latest reply on Mar 23, 2015 10:38 AM by 2679576

    problem in a trigger on MTL_TXN_REQUEST_LINES

    2679576

      Hi,

       

      i would like to set the attribute1 in the table MTL_TXN_REQUEST_LINES to 'yes' when clicking on the button allocate in the form panel TRANSACT MOVE ORDERS ( form :INVTOTRX.fmx) and set the attribute1 to 'NO' when the user cancels the allocation of the line. I worked a trigger for cancelling allocation

      create or replace 
      TRIGGER top_test_delete
      BEFORE UPDATE
         ON MTL_TXN_REQUEST_LINES
         FOR EACH ROW
        DECLARE
         n_val number;
         
      BEGIN
      
      
          select distinct MOVE_ORDER_LINE_ID
          into n_val
         from mtl_material_transactions_temp
         where MOVE_ORDER_LINE_ID=:new.line_id;
      
      
      
      
      if (n_val =null)then
      if(:new.organization_id=85) and (:new.transaction_type_id= 64) 
      then
      :new.attribute1:='N';
      
      
      end if;
      end if;
      
      
      EXCEPTION
      when no_data_found then 
      :new.attribute1:='N';
      
      
      
      
      
      END
      

      Cancelling the allocation works. but the allocation (set the attribute1 to yes) doens'nt work . I added the following code in the form INVTOTRX.fmb IN THE TRIGGER WHEN PRESSED BUTTON of DETAIL which is the button allocate

      TOP_UPDATE(:MTL_TRX_LINE.MOVE_ORDER_LINE_ID);
      

       

      PROCEDURE TOP_UPDATE(v_line_id number) IS
      BEGIN
      UPDATE MTL_TXN_REQUEST_LINES
      SET attribute1 = 'Y'
      where line_id=v_line_id;
      commit;
      END;
      

       

      but when i click on the button allocate the attribute1 stay 'NO' . Please could you help me to resolve this problem