Skip to Content

User Defined Object in SAP B1 9.2.

Hi all,

I want to create an add-on of user defined object.

I used the following codes in Menu.vb in order to find Add-on form in new module but the Add-on form located in the new module in SAP B1 is opening the form of UDO not form of add-on.

If (pVal.BeforeAction And pVal.MenuUID = "mm10.Form1") Then Application.SBO_Application.Menus.Item("MMS").Activate() 
End If

What can I do in order to load or to display Add-on form not UDO form?.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Best Answer
    Nov 01, 2016 at 01:22 AM

    Hi Rurangwa,

    You might want to save your AddonForm as the UDO Form.
    Check here

    Regards
    Edy

    ,

    Hi Rurangwa,

    You might want to save this form as the default UDO form so that your UDO Form is your Addon Form.
    Check here

    Regards

    Edy

    Add comment
    10|10000 characters needed characters exceeded

  • Oct 30, 2016 at 09:21 AM

    Hi Rurangwa,

    Do you mean you want to load a form you created in XML (using B1Studio or Screenpainter)? If that is the case, you'll need to capture the MenuEvent of the menu you want the form to be triggered from, and then call Application.LoadBatchAction(formXML).

    Pedro Magueija
    LinkedIn | Twitter | Blog

    Add comment
    10|10000 characters needed characters exceeded

    • Hi Pedro,

      This is the form I want to call

      As it seems its extension is .b1f is not XML.

      The following codes are for menu

      Imports SAPbouiCOM.Framework
      Namespace MMS
          Public Class Menu
              Private WithEvents SBO_Application As SAPbouiCOM.Application
              Sub New()
                  SBO_Application = Application.SBO_Application
              End Sub
              Sub AddMenuItems()
                  Dim oMenus As SAPbouiCOM.Menus
                  Dim oMenuItem As SAPbouiCOM.MenuItem
                  oMenus = Application.SBO_Application.Menus
                  Dim oCreationPackage As SAPbouiCOM.MenuCreationParams
                  oCreationPackage = (Application.SBO_Application.CreateObject(SAPbouiCOM.BoCreatableObjectType.cot_MenuCreationParams))
                  oMenuItem = Application.SBO_Application.Menus.Item("43520") 'Modules
                  oCreationPackage.Type = SAPbouiCOM.BoMenuType.mt_POPUP
                  oCreationPackage.UniqueID = "MMS"
                  oCreationPackage.String = "MMS"
                  oCreationPackage.Enabled = True
                  oCreationPackage.Position = -1
                  oMenus = oMenuItem.SubMenus
                  Try
                      'If the manu already exists this code will fail
                      oMenus.AddEx(oCreationPackage)
                  Catch
                  End Try
                  Try
                      'Get the menu collection of the newly added pop-up item
                      oMenuItem = Application.SBO_Application.Menus.Item("MMS")
                      oMenus = oMenuItem.SubMenus
                      ''Create s sub menu
                      oCreationPackage.Type = SAPbouiCOM.BoMenuType.mt_STRING
                      'Please replace following 2 "Form1" with real form class in current project
                      oCreationPackage.UniqueID = "MMS.Form1"
                      oCreationPackage.String = "Form1"
                      oMenus.AddEx(oCreationPackage)
                  Catch
                      'Menu already exists
                      Application.SBO_Application.SetStatusBarMessage("Menu Already Exists", SAPbouiCOM.BoMessageTime.bmt_Short, True)
                  End Try
              End Sub
              Sub SBO_Application_MenuEvent(ByRef pVal As SAPbouiCOM.MenuEvent, ByRef BubbleEvent As Boolean) Handles SBO_Application.MenuEvent
                  BubbleEvent = True
                  Try
                      If (pVal.BeforeAction And pVal.MenuUID = "MMS.Form1") Then
                          ''Please replace following 3 "Form1" with real form class in current project
                          'Dim activeForm As Form1
                          'activeForm = New Form1
                          'activeForm.Show()
                      End If
                  Catch ex As System.Exception
                      Application.SBO_Application.MessageBox(ex.ToString(), 1, "Ok", "", "")
                  End Try
              End Sub
          End Class
      End Namespace

      What are the codes of to display UDO_MMS.b1f in the menu I want the form to be triggered from?

      Please anyone can help me.

      screen-u.png (173.8 kB)
  • Oct 31, 2016 at 10:19 AM

    Hi Rurangwa,

    B1f is the extension of the file. Its contents are most likely XML.

    In any case, I noticed you are using B1Studio which has a "peculiar" way to open the forms.

    Please refer to this tutorial: https://www.youtube.com/watch?v=1PEcVa1e-9s

    Pedro Magueija
    LinkedIn | Twitter | Blog

    Add comment
    10|10000 characters needed characters exceeded