cancel
Showing results for 
Search instead for 
Did you mean: 

new submenu + screen painter

Former Member
0 Kudos

I created new sub menu 'PR' under AP, and also used screen painter to draw the form layout.

However, I tried to link them up, but is fails....

How to solve it? Is the following code suitable?

private void LoadFromXML(ref string FileName)

{

System.Xml.XmlDocument oXmlDoc = null;

oXmlDoc = new System.Xml.XmlDocument();

// load the content of the XML File

string sPath = null;

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

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

oXmlDoc.Load("D:
Program
SAP
SAPPR
" + FileName);

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

string sXML = oXmlDoc.InnerXml.ToString();

System.Windows.Forms.MessageBox.Show("ckpt 0400");

SBO_Application.LoadBatchActions(ref sXML);

System.Windows.Forms.MessageBox.Show("ckpt 0500");

}

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi...

try this code..

Private Sub AddMenuItem()

Dim oMenuItem As SAPbouiCOM.MenuItem

Dim oMenus As SAPbouiCOM.Menus

Dim oCreationPackage As SAPbouiCOM.MenuCreationParams

oCreationPackage = SBO_Application.CreateObject(SAPbouiCOM.BoCreatableObjectType.cot_MenuCreationParams)

oMenuItem = SBO_Application.Menus.Item("AP")

oCreationPackage.Type = SAPbouiCOM.BoMenuType.mt_STRING

If SBO_Application.Menus.Exists("XXXX") Then

SBO_Application.Menus.RemoveEx("XXXX")

End If

oCreationPackage.UniqueID = "XXXX"

oCreationPackage.String = "PR"

oCreationPackage.Enabled = True

oCreationPackage.Checked = True

oCreationPackage.Position = 0

oMenus = oMenuItem.SubMenus

oMenus.AddEx(oCreationPackage)

LoadFromXML()

End Sub

Regards...

Billa 2007

Edited by: Billa 2007 on Sep 30, 2008 9:33 AM

Former Member
0 Kudos

Use the following procedure.


Call GOD_Loadfromxml("WorkOrder.xml")

The Defination of the procedure will be as follows


Private Sub GOD_Loadfromxml(ByRef filename As String)
        'THIS IS THE STANDERD FUCTION TO LOAD ANY XML INTO THE SAP B1
        Dim oxmldoc As Xml.XmlDocument
        Dim spath As String
        Dim colorm As Integer

        Dim reccol As SAPbobsCOM.Recordset
        reccol = OCT_Company.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)
        reccol.DoQuery("select color from oadm")
        colorm = reccol.Fields.Item("color").Value
        oxmldoc = New Xml.XmlDocument
        Try
            spath = IO.Directory.GetCurrentDirectory '(Application.StartupPath).ToString
            oxmldoc.Load(spath & "\" & filename)
            OCT_Application.LoadBatchActions(oxmldoc.InnerXml)
            Select Case colorm
                Case 0
                    OCT_Application.Menus.Item("5633").Activate()
                Case 1
                    OCT_Application.Menus.Item("5633").Activate()
                Case 2
                    OCT_Application.Menus.Item("5634").Activate()
                Case 3
                    OCT_Application.Menus.Item("5635").Activate()
                Case 4
                    OCT_Application.Menus.Item("5636").Activate()
                Case 5
                    OCT_Application.Menus.Item("5637").Activate()
                Case 6
                    OCT_Application.Menus.Item("5638").Activate()
                Case 7
                    OCT_Application.Menus.Item("5639").Activate()
                Case 8
                    OCT_Application.Menus.Item("5640").Activate()
                Case 9
                    OCT_Application.Menus.Item("5641").Activate()
            End Select
            reccol = Nothing
            GC.Collect()
        Catch ex As Exception
            OCT_Application.MessageBox(ex.Message)
        End Try
        GC.Co

Hope this will help you.

Regards,

Mahendra

Former Member
0 Kudos

Thx.

But how to code it in menuevent?

I tried to code, but when I clicked the menu "PR", there was not popup PR form.

Ken