on 10-16-2008 5:43 AM
Hi all,
I have a problem and hope you help:
I created a new form and i want to add that form(submenu) on exist Module (Ex Module Human Resource)
how can i do?
Plz tell me details example)
Thks !
hi,
Dim oMenu As SAPbouiCOM.Menus = SBO_Application.Menus
Dim oMenuItem As SAPbouiCOM.MenuItem
oMenuItem = SBO_Application.Menus.Item("43544")
Dim oCreationPackage As SAPbouiCOM.MenuCreationParams
oCreationPackage = SBO_Application.CreateObject(SAPbouiCOM.BoCreatableObjectType.cot_MenuCreationParams)
Dim SPath As String
SPath = Application.StartupPath
If SBO_Application.Menus.Exists("UserMenuUID") Then
SBO_Application.Menus.RemoveEx("UserMenuUID")
End If
oCreationPackage.Type = SAPbouiCOM.BoMenuType.mt_STRING
oCreationPackage.UniqueID = "UserMenuUID"
oCreationPackage.String = "FormName"
oCreationPackage.Enabled = True
oCreationPackage.Checked = True
oCreationPackage.Position = 5 'starts from 0
oMenu = oMenuItem.SubMenus
Try
oMenu.AddEx(oCreationPackage)
Catch ex As Exception
MsgBox("Menu Already Exists")
End Try
regards,
varma
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi,
UserMenuUID is that which u can give of your own.
regards,
varma
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Varma,
I have scenario and hope you help: I want to add new form (subMenu) in exist Menu (Module HR)
I used UDO, created table: @INCENTIVE with fields: Code (Primary), Name, U_Incentive, U_Level1, U_Level2, U_Level3
Then, I wrote:
Private Sub DrawForm()
Dim bPriceVisible As Boolean = True
Dim f As SAPbouiCOM.Form
Dim oItem As SAPbouiCOM.Item
Dim oCombo As SAPbouiCOM.ComboBox
Dim oMatrix As SAPbouiCOM.Matrix
Dim oButton As SAPbouiCOM.Button
Dim oLabel As SAPbouiCOM.StaticText
Dim oEdit As SAPbouiCOM.EditText
Dim cp As SAPbouiCOM.FormCreationParams
cp =oApp.CreateObject(SAPbouiCOM.BoCreatableObjectType.cot_FormCreationParams)
cp.BorderStyle = SAPbouiCOM.BoFormBorderStyle.fbs_Fixed
cp.FormType = "FrmIncentive"
cp.ObjectType = "SM_MOR" - (I donu2019t know what is SM_MOR?)
cp.UniqueID = "Code" - (UniqueID is Primary in table?)
Try
f = oApp.Forms.AddEx(cp)
Catch ex As Exception
MsgBox(ex.Message)
End Try
' Defining form dimentions
f.ClientWidth = 370
f.ClientHeight = 300
' set the form title
f.Title = "Incentive's Day"
' Adding 3 Static Texts and Edit Items
' Name
oItem = f.Items.Add("lblLevel1", SAPbouiCOM.BoFormItemTypes.it_STATIC)
oItem.Left = 10
oItem.Top = 10
oLabel = oItem.Specific
oLabel.Caption = "Level 1"
' Level 1
oItem = f.Items.Add("lblLevel2", SAPbouiCOM.BoFormItemTypes.it_STATIC)
oItem.Left = 10
oItem.Top = 30
oLabel = oItem.Specific
oLabel.Caption = "Level 2"
' Level 2
oItem = f.Items.Add("lblLevel3", SAPbouiCOM.BoFormItemTypes.it_STATIC)
oItem.Left = 10
oItem.Top = 50
oLabel = oItem.Specific
oLabel.Caption = "Level 3"
' Hide The Price Field, It is calculated in the UDO
oItem.Visible = bPriceVisible
' Add 3 Edit Edit Items
' Level1
oItem = f.Items.Add("txtLevel1", SAPbouiCOM.BoFormItemTypes.it_EDIT)
oItem.Left = 60
oItem.Top = 10
oItem.AffectsFormMode = True
oItem.LinkTo = "lbllevel1"
'Binding
oEdit = oItem.Specific
oEdit.DataBind.SetBound(True, "@INCENTIVE", "U_Level1")
' Level 2
oItem = f.Items.Add("txtLevel2", SAPbouiCOM.BoFormItemTypes.it_EDIT)
oItem.Left = 60
oItem.Top = 30
oItem.AffectsFormMode = True
oItem.LinkTo = "lblLevel2"
'Binding
oEdit = oItem.Specific
oEdit.DataBind.SetBound(True, "@INCENTIVE", "U_Level2")
' Level 3
oItem = f.Items.Add("txtLevel3", SAPbouiCOM.BoFormItemTypes.it_EDIT)
oItem.Left = 60
oItem.Top = 50
oItem.AffectsFormMode = True
oItem.LinkTo = "lblLevel3"
oItem.Enabled = True
'Binding
oEdit = oItem.Specific
oEdit.DataBind.SetBound(True, "@INCENTIVE", "U_Level3")
' Add the Ok/Add/Update button
oItem = f.Items.Add("1", SAPbouiCOM.BoFormItemTypes.it_BUTTON)
oItem.Left = 10
oItem.Top = 270
' Add the cancel button
oItem = f.Items.Add("2", SAPbouiCOM.BoFormItemTypes.it_BUTTON)
oItem.Left = 90
oItem.Top = 270
' Add the Calculation incentive
oItem = f.Items.Add("Calculation", SAPbouiCOM.BoFormItemTypes.it_BUTTON)
oItem.Left = 290
oItem.Top = 270
oButton = oItem.Specific
oButton.Caption = "Calculation Incentive"
' Adding a matrix bound to MOR1
f.DataBrowser.BrowseBy = "txtlevel1"
' Show the form
f.Visible = True
End Sub
And,
Public Sub AddMenu()
'Add Menu
Dim oMenu As SAPbouiCOM.Menus = oApp.Menus
Dim oMenuItem As SAPbouiCOM.MenuItem
oMenuItem = oApp.Menus.Item("43544")
Dim oCreationPackage As SAPbouiCOM.MenuCreationParams
oCreationPackage = oApp.CreateObject(SAPbouiCOM.BoCreatableObjectType.cot_MenuCreationParams)
sPath = System.Windows.Forms.Application.StartupPath()
If oApp.Menus.Exists("UserMenuUID") Then
oApp.Menus.RemoveEx("UserMenuUID") * - What is UserMenuUID?*
End If
oCreationPackage.Type = SAPbouiCOM.BoMenuType.mt_STRING
oCreationPackage.UniqueID = "Code" (UniqueID is Primary in table?)
oCreationPackage.String = "Incentive"
oCreationPackage.Enabled = True
oCreationPackage.Checked = True
oCreationPackage.Position = 5 'starts from 0
oMenu = oMenuItem.SubMenus
Try
oMenu.AddEx(oCreationPackage)
Catch ex As Exception
MsgBox("Menu Already Exists")
End Try
End Sub
I run (F5) but it display subMenu.
How can I do? (Plz tell me details)
Thks & Rgds !
Hi Varm,
Thks for reply soon !
In this code, i don't know "UserMenuUID "
Plz explain details for me
Give me a example.
If oApp.Menus.Exists("UserMenuUID") Then
oApp.Menus.RemoveEx("UserMenuUID")
End If
oCreationPackage.Type = SAPbouiCOM.BoMenuType.mt_STRING
oCreationPackage.UniqueID = "UserMenuUID"
oCreationPackage.String = "frmIncentive"
oCreationPackage.Enabled = True
oCreationPackage.Checked = True
oCreationPackage.Position = 5 'starts from 0
oMenu = oMenuItem.SubMenus
Thks !
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
108 | |
12 | |
11 | |
6 | |
5 | |
4 | |
3 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.