Hello all,
in this brief blog post i will show you how to edit sap b1 system forms without having to struggle with manually editing your form definitionxml files and / or adding items in application item event discriminating by form type and so on.
keep your code neat. i'm using sdk 9.1, vs 2010 with sap b1 studio for ms visual studio
first of all open in sap b1 client the system form you're going to customize, then open visual studio and load your addin project / solution.
then from tools menu choose to edit in insidie ms visual studio.
you will be prompted to choose which visual studio instance you're going to use.
then you will find the system form ready to be edited and customized in visual studio.
you can add labels and buttons in wysiwyg style, attaching button click events, adding panes and objects in a visual manner, without the hassle of adding them by hand.
but most important of all you can access systemformbase class and manage events in the class without messing with application formdata and item events..
[FormAttribute("180", "Return.b1f")] class Return : SystemFormBase { public Return() { } /// <summary> /// Initialize components. Called by framework after form created. /// </summary> public override void OnInitializeComponent() { this.StaticText0 = ((SAPbouiCOM.StaticText)(this.GetItem("Item_0").Specific)); this.EditText0 = ((SAPbouiCOM.EditText)(this.GetItem("Item_1").Specific)); this.OnCustomInitialize(); } /// <summary> /// Initialize form event. Called by framework before form creation. /// </summary> public override void OnInitializeFormEvents() { this.DataDeleteBefore += new DataDeleteBeforeHandler(Return_DataDeleteBefore); } void Return_DataDeleteBefore(ref SAPbouiCOM.BusinessObjectInfo pVal, out bool BubbleEvent) { //throw new NotImplementedException(); //do your data control / validate stuff here BubbleEvent = true; }
the trick is done by the FormAttribute attribute, you can even use it in your classes to intercept system form events.
your code will be cleaner than ever, no more event routing via SBO_Application event handlers.