I'm using the SBO 2004C version
I'm in need of preventing the user from canceling some Production orders (or atleast, I need to reset some UserDefinedFields, before the user does cancel the PO).
I've tried handling the Application.MenuEvent "1284", but I'm unable to handle it before the document gets erased. The soonest possible event, I'm able to handle, is right after the Production Order has been canceled, the form gets cleared and reloaded. At this point, the pval.BeforeAction is false. Which is too late.
I've also tried the Disabling the "1284" - Cancel menu, but even when I do set it to enabled = false, nothing happends. In debug mode, I can see, that the menu has the enabled = false value, but when I do get back into application, I can see, that the menu is enabled again.
(was trying to disable it in the et_FORM_ACTIVATE event, pval.beforaction is false ... and also in MenuEvents handling the next/previous document)
As I said in the beginning, all this is required due to changing some UserDefinedFields both in the ProductionOrder and ProductionOrderLines (OWOR and WOR1, and some linking to the OITW userDefinedFields)...
But when the ProductionOrder gets Canceled status, I'm unable to modify/update the ProductionOrder's UserDefinedFields (I can modify the items userfields, but I do not know, which Production order was canceled, because the form does not contain the last Canceled ProductionOrder, and it goes to the Add mode directly).
Any idea, how to solve this problem?