You can use the consoleLib.cancelArrayInsert() system function to terminate the insert operation in progress during the execution of a BEFORE_INSERT openUI event code block. If you call this function outside the scope of an openUI statement, nothing happens.
consoleLib.cancelArrayInsert( )