Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

how to add the forms with sap business one menu list..

dear all,

i have created a form through screenpainter...i have saved the form in the xml format...i want to add these forms in the sap business one main menu list ,through .net..where can i find the menu item number... can u help me to find the solution for these problem...

Former Member
Former Member replied

hi shankar,

first u have to add ome menu item in sap b1 menu list(administrator,inventory,pruduction,human resource, etc) and after adding it, u have to catch the menu event and load the xml form.. i m sending code

menu id of sap b1 menu is 43520.

//////////////////code for adding menu/////////////////////////

oMenu = SBO_Application.Menus;

oMenuCreationPackage = (SAPbouiCOM.MenuCreationParams)SBO_Application.CreateObject(SAPbouiCOM.BoCreatableObjectType.cot_MenuCreationParams);

//oMenuCreationPackage1 = (SAPbouiCOM.MenuCreationParams)SBO_Application.CreateObject(SAPbouiCOM.BoCreatableObjectType.cot_MenuCreationParams);

oMenuItem = SBO_Application.Menus.Item("43520");

oMenu = oMenuItem.SubMenus;

string spath = null;

spath =Application.StartupPath;

spath = spath.Remove( spath.Length - 9, 9 );

//SBO_Application.MessageBox("hii" + spath,1,"ok","","");

//setting submenu values in the menu creation package

oMenuCreationPackage.Type = SAPbouiCOM.BoMenuType.mt_POPUP;

oMenuCreationPackage.UniqueID = "mymenu";

oMenuCreationPackage.String = "my first menu";

oMenuCreationPackage.Enabled = true;

oMenuCreationPackage.Position = 12;

try

{

oMenu.AddEx(oMenuCreationPackage);

oMenuItem = SBO_Application.Menus.Item("main_menu");

oMenu = oMenuItem.SubMenus;

// Create s sub menu

oMenuCreationPackage.Type = SAPbouiCOM.BoMenuType.mt_STRING;

oMenuCreationPackage.UniqueID = "sub_menu_admin2";

oMenuCreationPackage.String = "Sub menu";

oMenuCreationPackage.Position=1;

oMenu.AddEx(oMenuCreationPackage);

}

catch (Exception ex)

{

//SBO_Application.MessageBox(ex.Message, 1, "Ok", "", "");

SBO_Application.SetStatusBarMessage(ex.Message, SAPbouiCOM.BoMessageTime.bmt_Medium, true);

}

SBO_Application.MenuEvent += new SAPbouiCOM._IApplicationEvents_MenuEventEventHandler(SBO_Application_MenuEvent);

}

////////////////////// code for load form'x xml///////////////////////////////

private void SBO_Application_MenuEvent( ref SAPbouiCOM.MenuEvent pVal, out bool BubbleEvent )

{

string file;

file = ("per_udoForm.xml"); // ur xml file name

System.Xml.XmlDocument oXmlDoc = null;

oXmlDoc = new System.Xml.XmlDocument();

// load the content of the XML File

string sPath = null;

// sPath = Environment.CurrentDirectory;

sPath = System.IO.Directory.GetParent(Application.StartupPath).ToString();

sPath = System.IO.Directory.GetParent(sPath).ToString();

oXmlDoc.Load(sPath + "
" + FileName);

// load the form to the SBO application in one batch

string sXML = oXmlDoc.InnerXml;

SBO_Application.LoadBatchActions(ref sXML);

u can get more information from sample - creatingmenu and working with xml.

hape it will guide u.

if satisfied, rewards me some points

regards

nirdesh panwar

0 View this answer in context

Helpful Answer

by
Not what you were looking for? View more on this topic or Ask a question