Quantcast
Channel: SAP Business One SDK
Viewing all articles
Browse latest Browse all 49

how to edit system forms with the new sap b1 studio for microsoft visual studio

$
0
0

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.

1.png

 

then from tools menu choose to edit in insidie ms visual studio.

2.png

 

you will be prompted to choose which visual studio instance you're going to use.

 

3.png

 

then you will find the system form ready to be edited and customized in visual studio.

 

4.png

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.


Viewing all articles
Browse latest Browse all 49

Trending Articles