cancel
Showing results for 
Search instead for 
Did you mean: 
SAP Community Downtime Scheduled for This Weekend

Create chein SubMenu

Former Member
0 Kudos
104

I know how to create a menu in SAP and its various sub menus. I do not know how to create a submenu that has within it another submenu.

For example:

Main Menu

..................Sub Menu X

.................................Cadastre

...............................................Officials

...............................................Service provided

.................................Parameters

...............................................XXXX

...............................................Tables

..................Sub Menu Y

.................................Calculations

...............................................RPA

How to create menus that order?

Edited by: harley.rodrigues on Jan 12, 2012 3:28 PM

Edited by: harley.rodrigues on Jan 12, 2012 3:36 PM

Accepted Solutions (1)

Accepted Solutions (1)

former_member201110
Active Contributor
0 Kudos

Hi Harley,

It's probably easiest to use the XML interface to load your menu structure in one batch.

Based on your example, the XML file to create the menus would be something like the following:


<Application>
  <Menus>
    <action type="add">
      <Menu Checked="0" Enabled="1" FatherUID="43520" String="Sub Menu X" Type="2" UniqueID="MENUID1" Image="">
        <Menus>
          <action type="add">
            <Menu Checked="0" Enabled="1" FatherUID="MENUID1" String="Cadastre" Type="2" UniqueID="MENUID2" Image="">
              <Menus>
                <action type="add">
                  <Menu Checked="0" Enabled="1" FatherUID="MENUID2" String="Officials" Type="1" UniqueID="MENUID4" Image=""/>
                  <Menu Checked="0" Enabled="1" FatherUID="MENUID2" String="Service Provided" Type="1" UniqueID="MENUID5" Image=""/>
                </action>
              </Menus>
            </Menu>
            <Menu Checked="0" Enabled="1" FatherUID="MENUID1" String="Parameters" Type="2" UniqueID="MENUID3" Image="">
              <Menus>
                <action type="add">
                  <Menu Checked="0" Enabled="1" FatherUID="MENUID3" String="XXXX" Type="1" UniqueID="MENUID6" Image=""/>
                  <Menu Checked="0" Enabled="1" FatherUID="MENUID3" String="Tables" Type="1" UniqueID="MENUID7" Image=""/>
                </action>
              </Menus>
            </Menu>
          </action>
        </Menus>
      </Menu>
      <Menu Checked="0" Enabled="1" FatherUID="43520" String="Sub Menu Y" Type="2" UniqueID="MENUID8" Image="">
        <Menus>
          <action type="add">
            <Menu Checked="0" Enabled="1" FatherUID="MENUID8" String="Calculations" Type="2" UniqueID="MENUID9" Image="">
              <Menus>
                <action type="add">
                  <Menu Checked="0" Enabled="1" FatherUID="MENUID9" String="RPA" Type="1" UniqueID="MENUID10" Image=""/>
                </action>
              </Menus>
            </Menu>
          </action>
        </Menus>
      </Menu>
    </action>
  </Menus>
</Application>

And the code to load the XML to create the menus would be as follows:


private void AddMenus()
{
    SAPbouiCOM.Form form = null; 
    XmlDocument doc = null; 
    String xml  = "";

    // Get a reference to the Main Menu form
    form = sboApp.Forms.GetFormByTypeAndCount(169, 1);

    // Freeze it to minimise flickering
    form.Freeze(true);

    try
    {
        // Load the menus to the SBO application in one batch
        doc = new XmlDocument();
        doc.Load(System.Windows.Forms.Application.StartupPath.ToString() + "\\Menus\\MENUS_ADD.xml");
        xml = doc.InnerXml.ToString();
        sboApp.LoadBatchActions(xml);
    }
    catch(Exception ex)
    {
        sboApp.SetStatusBarMessage(ex.Message, SAPbouiCOM.BoMessageTime.bmt_Long, true);
    }
    finally
    {
        // Unfreeze and update the Main Menu form
        form.Freeze(false);
        form.Update();
    }
}

Kind Regards,

Owen

Answers (0)