Show SAP B1 Form
I want to show the user a SAP B1 Form and I want to do some changes to it. Currently I'm using this kind of code:
SwissAddonFramework.UI.Components.Form.OpenFormByKey("4", "ID123456789"); // Article Base data
SwissAddonFramework.UI.Components.Form myForm = SwissAddonFramework.UI.Components.Form.GetFormFromUID(
In my opinion its ugly cody to load a form and then get a handle on it by receiving the active form. Is there a more beautiful way?
What about GetFormByTypeAndCount(IntType, IntCount)?
I think this function will give me a specific form by typ and a number. If several forms of the same kind were opened, my newly opend form would have the highest count I think? So where do I get the form-counter for a specific type of form?
This is my current workaround to get a "save" grip on a newly created form:
' Open new CustomerOrder form:
Dim oForm As SwissAddonFramework.UI.Components.Form = SwissAddonFramework.UI.Components.Form.GetFormFromType("139", 1)
oForm = SwissAddonFramework.UI.Components.Form.GetFormFromType("139", oForm.TypeCount)
Here is a onliner that will open a Sales Order with DocEntry 290 that returns the Form object.
Form form = Form.GetFormFromUID(SwissAddonFramework.B1Connector.GetB1Connector().Application.OpenForm(SAPbouiCOM.BoFormObjectEnum.fo_Order, "17", "290").UniqueID);
Not sure if it's beautiful though...
"17" is the object type for sales orders. For a complete list, refer to the sticky thread at the top of this forum.
This is possible since SAP 8.81.