Hi Ravi,
the best practice for enabling - disabling form items on an udo that is AutoManaged is using the SetAutoManagedAttribute of an item. If you take a look to your SDK you will find the way!
My approach for this (because its hard to remember the integers that the function haves as arguments) is the function below that i have placed it in a DLL.
public static void AutoManageAttribute(SAPbouiCOM.Item _oItem, BoAutoManagedAttr _enAttribute, BoAutoFormMode _enFormMode, BoModeVisualBehavior _enBehavior) { try { _oItem.SetAutoManagedAttribute(_enAttribute, (int)_enFormMode, _enBehavior); } catch (Exception ex) { var a = new Logging("UI.AutoManageAttribute", ex); } }You can call this code with this sample
MYDLL.UI.AutoManageAttribute(FORMS_ITEM, BoAutoManagedAttr.ama_Editable, BoAutoFormMode.afm_All, BoModeVisualBehavior.mvb_False); MYDLL.UI.AutoManageAttribute(FORMS_ITEM, BoAutoManagedAttr.ama_Editable, BoAutoFormMode.afm_Find, BoModeVisualBehavior.mvb_True);
This code makes the item named FORMS_ITEM for all modes except Find, disable.
Also if you declare hardcoded the uid, if i'm correct, the SAPB1 cannot open a new instance of the form. Witch means that you will not be able to use 2 same UDO forms in the same time (eg. for comparison). If you leave empty the form uid SAPB1 will use a generic number for main uid and will add at the end of this code, an integer that represents the counter of the parallel instances of the form.
Kind Regards,
Evangelos D. Plagianos
FORMS_ITEMFORMS_ITEM b