Skip to Content

hello all,

i found particularly useful to extend sap b1 sdk objects with custom static methods to simplify and generalize common operations which need the same boring instructions to perform some basic tasks.

for example:

we have to set a particular cell value in a matrix

instead of writing every time we need to set a value:

((SAPbouiCOM.EditText)matrix.Columns.Item("U_CUSTOMTEXT").Cells.Item( 7 ).Specific).Value = "text value to set";
((SAPbouiCOM.EditText)matrix.Columns.Item("U_CUSTOMVALUE").Cells.Item( 12 ).Specific).Value = "value to set";

why not trying to extend the matrix object with an extension method?

public static class MatrixHelpers
       public static void SetCellValue(this SAPbouiCOM.Matrix matrix, String colUID, int rowIdx, String value)
                ((SAPbouiCOM.EditText)matrix.Columns.Item(colUID).Cells.Item(rowIdx).Specific).Value = value;
            catch (Exception ex)

now, as long as you include in the usings list in your classes the namespace containing the class above, you can set a value with only:

matrix0.SetCellValue("U_CUSTOMTEXT",7,"text value to set");

nice. less code.


To report this post you need to login first.

Be the first to leave a comment

You must be Logged on to comment or reply to a post.

Leave a Reply