Skip to Content
0
Former Member
Nov 08, 2007 at 09:55 PM

Prevent a User From Deleting A Row on Sales Order Form

181 Views

Hello:

I have been trying (unsuccessfully) to prevent a user from deleting a matrix row on the sales order. The approach that I am taking is capturing the Menu Item Event for the Delete Row and setting the bubbleEvent to false hoping this will abort the procedure. However, it seems that setting the bubbleEvent to false has no effect and SAP continues to delete the row. I've stepped through my code in the debugger and know that it is working the way it is suppose to.

Does anyone have any suggestions?

Here is my code, if you are wondering:

public override void HandleMenuEvent(ref MenuEvent pVal, out bool bubbleEvent)

{

bubbleEvent = true;

Form form = Application.Forms.ActiveForm;

if((form.Type == 139 || form.Type == 60091) && pVal.BeforeAction)

{

if(pVal.MenuUID == "1293") // Delete Row

{

Matrix lineItemMatrix = (Matrix)form.Items.Item(SAPUIConstants.SO_LINE_ITEM_GRID).Specific;

int row = lineItemMatrix.GetNextSelectedRow(0, BoOrderType.ot_RowOrder);

if(row > -1)

{

if(ItemIsLocked(form, row))

{

Application.StatusBar.SetText("You cannot delete a locked row.", BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Error);

bubbleEvent = false;

}

}

}

}

}

Thanks in advance!