Hi All,
I have to add new lines in the matrix system only through the itemcode and item quantity. I tried several ways without success. Maybe the following code help to explain what I'm trying to do.
Someone already inserted rows in the matrix system? Can someone show me how I can do. This example is in C# but if someone has in VB I will apreciate.
FormUID = SBO_Application.Forms.ActiveForm.UniqueID;
f = SBO_Application.Forms.Item(FormUID);
try
{
SAPbobsCOM.Recordset oRS;
oRS = ((SAPbobsCOM.Recordset)oCompany.GetBusinessObje
SAPbobsCOM.BoObjectTypes.BoRecordset));
oItem = f.Items.Item("38");
oMatrix = ((SAPbouiCOM.Matrix)(oItem.Specific));
oEditText = ((SAPbouiCOM.EditText)oMatrix.Columns.Item(3).Cells.Item(oMatrix.RowCount - 1).Specific);
string Codigo = oEditText.Value; //Select the item number to use in strQuery
strQuery = "SELECT U_ART_COM FROM [@SB1EVOL_COMPOSTOS] where
U_ART_PRI='" + Codigo.ToString();
oRS.DoQuery(strQuery);
if (oRS.RecordCount > 0)
{
oRS.MoveFirst();
numart = oRS.RecordCount;
f.Freeze(true);
for (j = 1; j <= numart; j++)
{
try
{
ItemCodeTXT = oRS.Fields.Item(0).Value.ToString();
oEditText = ((SAPbouiCOM.EditText)(oMatrix.Columns.Item(3).Cells.Item(oMatrix.RowCount).Specific));
oEditText.Value = ItemCodeTXT.ToString();
f.Update();
oRS.MoveNext();
}
catch (Exception oEx)
{
f.Freeze(false);
f.Update();
MessageBox.Show(oEx.Message + " j = " + System.Convert.ToString(j));
}
}
j = 0;
f.Freeze(false);
f.Update();
}
In this example i try to add rows in Invoice matrix.
Thanks in advance.
Edited by: Luís Filipe Duarte on Jun 26, 2009 4:14 PM
Edited by: Luís Filipe Duarte on Jun 26, 2009 4:17 PM