Matrix Rows.Count value not correct when deleting rows in matrix
Hello Coresystems,
i have an issue with the rows.count value of a matrix. In a optimizer rule I catch the update Event to check some values in the production matrix table before the changes get applied.
This code works if only one line in the table of production order is deleted.
// get WOR1 table of production order
mWOR1 = Matrix.GetFromUID(pVal.Form, "37"); // WOR1 table
// loop through matrix
for(i = 0; i < mWOR1.Rows.Count - 1; i++)
{
ItemCode = mWOR1.GetValue("4", i);
}
But if I delete 2 lines at once first and press then the Update SAP form Button, then the code crashes with "matrix invalid row number". Rows.Count does not recognize deleted rows!
I thought that this value is the current value with every execution of the rule. Does anybody knows a solution or workaround for this?
Thank you in advance, Sebastian
-
Hello Coresystems Community,
for those who having the same issue. For bom and production order table matrix you have to use matrix.Rows.VisualCount - 1 to detect all visible lines. Loop with matrix.Rows.Count - 1 through the table works within bom in SAP 9.2, but not in a production order. In SAP 9.3. it also doens't work within a bom. Those tables having a different structure as tables of marketing documents, where matrix.Rows.Count - 1 returns the correct nummber of rows, after deleting rows.
I hope it helps...
Gretings Sebastian
0
Please sign in to leave a comment.
Comments
1 comment