on 2011 Sep 14 7:13 AM
Experts,
Can we write Code for matix so that like in std B1, right click Add row and delete row will be thre
Request clarification before answering.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I have written like below
Case "DeleteRow"
Try
Dim omatrix As SAPbouiCOM.Matrix
omatrix = objform.Items.Item("mtx_0").Specific
If omatrix.RowCount > 0 Then
Dim rows As Integer = omatrix.RowCount
For i As Integer = 1 To rows
If omatrix.IsRowSelected(i) = True Then
Dim result As Integer
result = SBO_Appln.MessageBox("Do You Want to Delete This Row", 1, "Yes", "Cancel")
If result = 1 Then
omatrix.DeleteRow(i)
objform.Mode = SAPbouiCOM.BoFormMode.fm_UPDATE_MODE
Exit For
End If
End If
Next
End If
Catch ex As Exception
SBO_Appln.MessageBox(ex.Message)
End Try
It is working now till deleting row and updating document, But...
After deleting, the row numbers are coming odd.
not insequential manner. please help
For delete row try this code
If _form.Mode <> BoFormMode.fm_FIND_MODE Then
Dim oMatrix As SAPbouiCOM.Matrix = _form.Items.Item(_matrixUID).Specific
Dim selRow As Integer = oMatrix.GetNextSelectedRow(0, BoOrderType.ot_SelectionOrder)
If selRow = -1 Then
B1Connections.theAppl.SetStatusBarMessage("Select a row to delete. ", BoMessageTime.bmt_Short, True)
Else
oMatrix.DeleteRow(selRow)
If _form.Mode <> BoFormMode.fm_ADD_MODE Then _form.Mode = BoFormMode.fm_UPDATE_MODE
End If
End If
Regards
Arun
Hi shrutisapsen
after adding or deleting row try this code to reassign the row nos
With form.DataSources.DBDataSources.Item("@TABLE") '@TABLE is the name of the DBDataSource the form's connect to
.clear()
matrix.FlushToDataSource()
For iRow = 0 To .Size - 1
.SetValue("U_RowNo", iRow, (iRow + 1).ToString) 'U_RowNo is the db field binded with your row no column
Next
End With
matrix.LoadFromDataSource()
Hope this helps you
Regards
Arun
Hi,
For Delete Row U need to write this code
Try This.......
'WRITE IN MENU EVENT
if pval.menuid='delrow' and pval.beforeaction=false then
Try
Dim omatrix As SAPbouiCOM.Matrix
oform = sbo_application.Forms.Item(FormUID)
omatrix = oform.Items.Item("mat_emp").Specific
If omatrix.RowCount > 0 Then
For i As Integer = 1 To omatrix.RowCount
If omatrix.IsRowSelected(i) = True Then
Dim result As Integer
result = sbo_application.MessageBox("Do You Want to Delete This Row", 1, "OK", "Cancel")
If result = 1 Then
omatrix.DeleteRow(i)
End If
End If
Next
End If
Catch ex As Exception
sbo_application.MessageBox(ex.Message)
End Try
end if
Thanks
Shafi
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
If You are using the Matrix With UDO then it will Come Automatically
If You are using the Non-UDO form then u need to try the beloc code
Try This.......
'WRITE THIS CODE IN RIGHT CLICK EVENT
If eventInfo.FormUID = "sample" Then
If (eventInfo.BeforeAction = True) Then
Dim oMenuItem As SAPbouiCOM.MenuItem
Dim oMenus As SAPbouiCOM.Menus
Try
Dim oCreationPackage As SAPbouiCOM.MenuCreationParams
oCreationPackage = sbo_application.CreateObject(SAPbouiCOM.BoCreatableObjectType.cot_MenuCreationParams)
oCreationPackage.Type = SAPbouiCOM.BoMenuType.mt_STRING
oCreationPackage.UniqueID = "OnlyOnRC"
oCreationPackage.String = "AddRow"
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
The Above code Creates the Add Menu when u right click
U need to write the logic for right click menu
Thanks
Shafi
Edited by: shafi_sunshine on Sep 14, 2011 8:31 AM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi
Yes but you have to write code for that first enable menus 1292 and 1293
oForm.EnableMenu("1292", True)
oForm.EnableMenu("1293", True)
then catch the before menu click event and write code for delete row and add row and set bubbleevent =false
1292 - add row
1293 - delete row
Regards
Arun
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
95 | |
10 | |
10 | |
9 | |
6 | |
6 | |
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.