on 05-24-2011 7:12 PM
How do we know if a user deleted a line by the right click on the line and pressing Delete row ?
Or any way to know that a user is deleting a line so we can take action if so ?
menu event with id 1293 is generated
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Im doing it as
If pVal.MenuUID = "1293" And pVal.BeforeAction = False Then
Dim oform As SAPbouiCOM.Form
oform = SBO_Application.Forms.ActiveForm
If oform.UniqueID = "xform" Then
Dim omatrix As SAPbouiCOM.Matrix
omatrix = oform.Items.Item("Matrix1").Specific
Dim q As Integer = 1
For q = 1 To omatrix.RowCount
If omatrix.IsRowSelected(q) Then
omatrix.DeleteRow(q) -- here in q is selected row
End If
Next
End If
End If
Hi,
use form load event,msg box form type='0' and if item=1(yes) else item=2(No).
try this one.
Regards,
Siva
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
This would be ok when I know which line the user wants to delete and the code I showed is prety complete but the problem is that when the user right click any line, even before the contextual menu appears to click DELETE ROW, the line is unselected by SAP which makes us unable to know which line the user want to delete.
The popup works prety good but is useless if once there we don't know which line was to be deleted.
Any good idea on the subject ?
Can you use the Click and Rightclick events to monitor what line the user is clicking, store it in a variable and then use it when the delete row menuuid is raised?
That's what I did and it works. thank you for the idea.
However I would point that this is a workaround something that should be easier for us to work with. I don't know where to post suggestion to SAP to improve the product since I develop for SAP for about 5 years now I find things that never changed and would make developer happy by making slight changes to the way we work with the System matrix
I tried the last suggestions and when I right click the line to delete it. the IsRowSelected returns false as it looks like unselected after right clicking it. How do I get the line the user wanted to delete so I can pop a message asking if he's sure he wants to delete the line
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Here's the code :
if (pVal.MenuUID == "1293" && pVal.BeforeAction)
{
SAPbouiCOM.Form oForm = SBO_Application.Forms.ActiveForm;
if (oForm.Type == SAPFramework.Enums.FORMS_TYPE.B1_SALESORDER)
{
SAPbouiCOM.Matrix oMatrix = oForm.Items.Item(SAPFramework.Enums.MATRIX_TYPE.B1_SALESORDER).Specific as SAPbouiCOM.Matrix;
for (int iRowToSearch = 1; iRowToSearch < oMatrix.RowCount; iRowToSearch++)
{
// This doesn't seem to work as none of the lines in the matrix are selected even thought I selected it before deleting it
// The way I do it is right clicking the line and using the context menu to delete but when the context menu appears the line is unselected
if (oMatrix.IsRowSelected(iRowToSearch))
{
if ("CP, SS, TR".IndexOf(((SAPbouiCOM.EditText)oMatrix.GetCellSpecific("ItemCode", iRowToSearch)).Value, StringComparison.InvariantCultureIgnoreCase) != -1)
{
if (SBO_Application.MessageBox("Êtes-vous certain de vouloir effecer ce kit ?", 2, "Oui", "Non", "") == 1)
{
//-------------------------------------------------------------------------------------------------------------
// Keep the KitSeq of the parent and start searchning it in the matrix to delete all line that have this KitSeq
//-------------------------------------------------------------------------------------------------------------
string KitSeq = ((SAPbouiCOM.EditText)oMatrix.GetCellSpecific("U_KitSeq", iRowToSearch)).Value;
for (int iRowToDelete = 1; iRowToDelete < oMatrix.RowCount; iRowToDelete++)
{
if (((SAPbouiCOM.EditText)oMatrix.GetCellSpecific("U_KitSeq", iRowToDelete)).Value == KitSeq)
{
oMatrix.DeleteRow(iRowToDelete);
iRowToDelete--;
}
}
}
}
break;
}
}
}
}
Hi Marc,
Try This.......
'Before deleting a row it pop up a message box for confirmation
Try
Dim omatrix As SAPbouiCOM.Matrix
oform = sbo_application.Forms.Item(FormUID)
omatrix = oform.Items.Item("mat_emp").Specific
If omatrix.RowCount > 0 Then
'sbo_application.MessageBox(omatrix.RowCount)
'sbo_application.MessageBox(omatrix.VisualRowCount)
For i As Integer = 1 To omatrix.RowCount
If omatrix.IsRowSelected(i) = True Then
'sbo_application.MessageBox("Row" & i & "is Selected")
Dim odb As SAPbouiCOM.DBDataSource
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
'omatrix.DeleteRow(i)
'End If
End If
Next
End If
Catch ex As Exception
sbo_application.MessageBox(ex.Message)
End Try
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 row is delete from such document you can come to know by Change Log , but It hard to find which row was deleted .
Thanks
Kevin
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
103 | |
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.