Skip to Content
0

User Defined Object in SAP B1 9.2.

Oct 28, 2016 at 12:10 PM

310

avatar image

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?.

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

3 Answers

Best Answer
Edy Simon Nov 01, 2016 at 01:22 AM
0

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

Show 2 Share
10 |10000 characters needed characters left characters exceeded

Hi Edy,

Yes I did save to the database in B1 studio that's good option. But I want to ask you if it is possible to display form of UDO from visual studio into SAP as it's possible when we use user form where we edit the following codes in visual studio

                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

Please help me for more explanation.

0

Thank you Edy.

0
avatar image
Former Member Oct 30, 2016 at 09:21 AM
0

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

Show 1 Share
10 |10000 characters needed characters left 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)
0
avatar image
Former Member Oct 31, 2016 at 10:19 AM
0

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

Share
10 |10000 characters needed characters left characters exceeded