on 09-05-2008 1:06 PM
I have created a new form through screen painter for adding user defined fields.I want to delete record by right clicking on the form and selecting Remove.This functionality can be seen in Item Master.
If ur dealing with a UDO this can be very easily achieved..
After the form load execute this code so that the menu will be enabled.
objForm.EnableMenu("1283", True)
this will enable the menu.
If ur form is not an UDO then in the menu CLICK u have u write the code to delete the record.
Hope it helps,
Vasu Natari.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Vasu,
I have enabled the menu as,
objForm.EnableMenu("1283", True)
I have fired the Delete function as,
Private Sub SBO_Application_MenuEvent(ByRef pVal As SAPbouiCOM.MenuEvent, ByRef BubbleEvent As Boolean) Handles SBO_Application.MenuEvent
If pVal.MenuUID = "1283" And pVal.BeforeAction = True And pVal.InnerEvent = False Then
Delete()
End If
End Sub
But the event is getting fired multiple times.I want to perform delete operation only once.It works prpoerly when the first is loaded for the first time.Afterwards,the event is fired multiple times.
Hi,
Please make the following change and check..
Private Sub SBO_Application_MenuEvent(ByRef pVal As SAPbouiCOM.MenuEvent, ByRef BubbleEvent As Boolean) Handles SBO_Application.MenuEvent
If pVal.MenuUID = "1283" And pVal.BeforeAction = True And pVal.InnerEvent = False Then
Delete()
BubbleEvent = False
End If
End Sub
Hope it solves the problem,
Vasu Natari.
Hi,
Try this Code:
Before that Enable the menu as
oForm.EnableMenu("1293",True)
Menu Event...
If (pVal.MenuUID = "1293") And (pVal.BeforeAction = False) Then
Try
Dim oMenuItem As SAPbouiCOM.MenuItem
Dim oMenus As SAPbouiCOM.Menus
Dim omat As SAPbouiCOM.Matrix
Dim GCols As SAPbouiCOM.Columns
Dim i As Integer
oitem = OForm.Items.Item("Ur Matrix")
omat = oitem.Specific
GCols = omat.Columns
omat = OForm.Items.Item("urmatrix").Specific
For i = 1 To omat.RowCount
If omat.IsRowSelected(i) = True Then
omat.DeleteRow(i)
Exit For
End If
Next
Catch ex As Exception
SBO_Application.MessageBox(ex.Message)
End Try
End If
Regards
Mohana
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi...
use this code and change ur matrix id...
Private Sub SBO_Application_RightClickEvent(ByRef eventInfo As SAPbouiCOM.ContextMenuInfo, ByRef BubbleEvent As Boolean) Handles SBO_Application.RightClickEvent
If eventInfo.FormUID = "Ur Form ID" Then
If (eventInfo.BeforeAction = True) Then
Dim oMenuItem As SAPbouiCOM.MenuItem
Dim oMenus As SAPbouiCOM.Menus
Dim omat As SAPbouiCOM.Matrix
Dim GCols As SAPbouiCOM.Columns
oitem = OForm.Items.Item("Ur Matrix")
omat = oitem.Specific
GCols = omat.Columns
Try
selItem = eventInfo.ItemUID
Dim oCreationPackage As SAPbouiCOM.MenuCreationParams
oCreationPackage = SBO_Application.CreateObject(SAPbouiCOM.BoCreatableObjectType.cot_MenuCreationParams)
oCreationPackage.Type = SAPbouiCOM.BoMenuType.mt_STRING
oCreationPackage.UniqueID = "OnlyOnRC"
oCreationPackage.String = "Delete Row"
oCreationPackage.Enabled = True
oMenuItem = SBO_Application.Menus.Item("1280") 'Data'
oMenus = oMenuItem.SubMenus
oMenus.AddEx(oCreationPackage)
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
Else
Dim oMenuItem As SAPbouiCOM.MenuItem
Dim oMenus As SAPbouiCOM.Menus
Try
SBO_Application.Menus.RemoveEx("OnlyOnRC")
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
End If
End If
End Sub
Menu Event...
If (pVal.MenuUID = "OnlyOnRC") And (pVal.BeforeAction = False) Then
Try
Dim oMenuItem As SAPbouiCOM.MenuItem
Dim oMenus As SAPbouiCOM.Menus
Dim omat As SAPbouiCOM.Matrix
Dim GCols As SAPbouiCOM.Columns
Dim i As Integer
oitem = OForm.Items.Item("Ur Matrix")
omat = oitem.Specific
GCols = omat.Columns
omat = OForm.Items.Item(selItem).Specific
For i = 1 To omat.RowCount
If omat.IsRowSelected(i) = True Then
omat.DeleteRow(i)
Exit For
End If
Next
Catch ex As Exception
SBO_Application.MessageBox(ex.Message)
End Try
End If
It will work..
Regards..
Billa 2007
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
100 | |
11 | |
11 | |
6 | |
6 | |
5 | |
4 | |
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.