The best way I have found is to invoke your code when the cursor returns to the 'Order Type' field on the 'Enter Orders' Header screen (OE0101.0). I usually set the macform.tag to <empty> when the screens opens, then reset it to the Order Type and Order Number when the user has selected (or created) one. When the user finishes entering line items, the cursor always goes back to the Order Type field which allows you to run Flex code after Macola has finished writing all the line items. In the Type_GotFocus event, if the macform.tag is not blank then run some code. The previous Order Type and Order No are preserved in the macform.tag, so you can read/write to the data tables without any locked record issues. Remember to clear the macform.tag when you're done!