on 06-27-2012 1:52 PM
Hi.. See the image..
This is my user addon..
There is one matrix is there...
there two cells are there in the matrix..(in red colour)
i wan to add some below valuse(see the program ) to that column cell how can i add values to it..
i had tried below code it was not work..
i had took keydown event is it current..
and one more point is i tried udt.. i was created two fields
and assign some examples like
udt1 udt2
no - no bike-bike
nh-nh car-car
hq train-train
and i assigned these two to the below column ( in image)(mode of travel and return hq)
the values are pop-up and and i am able to choose it to the cell (first time).
so, i want to change the what i had choosen
so, I reselect another value but it is not changing the exisitng cell value..
i choose below program but it wont work how can i solve this one...
If pVal.FormUID = "TT" And pVal.ItemUID = "222" And pVal.EventType = SAPbouiCOM.BoEventTypes.et_KEY_DOWN And pVal.BeforeAction = False Then
Try
oform = sbo_app.Forms.Item("TT")
'If oform.PaneLevel = 0 Then
' omatrix = oform.Items.Item("1").Specific
'ElseIf oform.PaneLevel = 1 Then
' omatrix = oform.Items.Item("2").Specific
'End If
'If omatrix.RowCount = 0 And oform.Items.Item("222").Specific.Value <> "" Then
' omatrix.AddRow(1)
ocombo = omatrix.Columns.Item("V_15").Cells.Item(1).Specific
If ocombo.ValidValues.Count > 0 Then
For i As Integer = 0 To ocombo.ValidValues.Count - 1
ocombo.ValidValues.Remove(0, SAPbouiCOM.BoSearchKey.psk_Index)
Next
End If
ocombo.ValidValues.Add("No", "No")
ocombo.ValidValues.Add("Hq", "Hq")
ocombo.ValidValues.Add("NH", "NH")
ocombo.Select("No", SAPbouiCOM.BoSearchKey.psk_ByValue)
ocombo = omatrix.Columns.Item("V_14").Cells.Item(1).Specific
If ocombo.ValidValues.Count > 0 Then
For i As Integer = 0 To ocombo.ValidValues.Count - 1
ocombo.ValidValues.Remove(0, SAPbouiCOM.BoSearchKey.psk_Index)
Next
End If
ocombo.ValidValues.Add("No", "No")
ocombo.ValidValues.Add("Bike", "Bike")
ocombo.ValidValues.Add("Car", "Car")
ocombo.ValidValues.Add("Bus", "Bus")
ocombo.ValidValues.Add("Train", "Train")
ocombo.ValidValues.Add("Others", "Others")
ocombo.Select("No", SAPbouiCOM.BoSearchKey.psk_ByValue)
'End If
Catch ex As Exception
sbo_app.MessageBox(ex.Message)
End Try
End If
Hi...
First you have to make sure that your column in the matrix are of type ComboBox.
I am providing you a sample code. Go through this according to your process.
if ((pVal.ItemUID == enControlName.mtxDetails) && (pVal.ColUID == enControlName.colItemCode) && (strUid == enCFL.ItemCFL1))
{
//this.SBO_Application.SetFilter(new SAPbouiCOM.EventFilters());
this.m_SBO_Form.Freeze(true);
SAPbouiCOM.Matrix oMatrix = default(SAPbouiCOM.Matrix);
oMatrix = (SAPbouiCOM.Matrix)this.m_SBO_Form.Items.Item(pVal.ItemUID).Specific;
int i = 0;
int Row = pVal.Row;
for (i = 0; i <= oDataTable.Rows.Count - 1; i++)
{
try
{
oEdit = (SAPbouiCOM.EditText)oMatrix.Columns.Item(enControlName.colItemCode).Cells.Item(Row).Specific;
oEdit.Value = oDataTable.GetValue("ItemCode", i).ToString();
}
catch { }
try
{
oEdit = (SAPbouiCOM.EditText)oMatrix.Columns.Item(enControlName.colItemName).Cells.Item(Row).Specific;
oEdit.Value = oDataTable.GetValue("ItemName", i).ToString();
((SAPbouiCOM.EditText)oMatrix.Columns.Item(enControlName.colUPrice).Cells.Item(Row).Specific).Value = oDataTable.GetValue("LastPurPrc", i).ToString();
((SAPbouiCOM.EditText)oMatrix.Columns.Item(enControlName.colInStock).Cells.Item(Row).Specific).Value = oDataTable.GetValue("OnHand", i).ToString();
((SAPbouiCOM.EditText)oMatrix.Columns.Item(enControlName.colIntlQty).Cells.Item(Row).Specific).Value = "0.0";
((SAPbouiCOM.EditText)oMatrix.Columns.Item(enControlName.approvedqty).Cells.Item(Row).Specific).Value = "0.0";
((SAPbouiCOM.EditText)oMatrix.Columns.Item(enControlName.colReqQty).Cells.Item(Row).Specific).Value = "0.0";
((SAPbouiCOM.EditText)oMatrix.Columns.Item(enControlName.colReqFor).Cells.Item(Row).Specific).Value = "";
oMatrix.AddRow(1, oMatrix.VisualRowCount);
FillBOQ();
Row = Row + 1;
CleanRow();
}
catch { }
finally { this.m_SBO_Form.Freeze(false); }
}
FillBOQ() method is adding values to the matrix columns as follows :
private void FillBOQ()
{
try
{
SAPbouiCOM.Matrix oMatrix = default(SAPbouiCOM.Matrix);
SAPbobsCOM.Recordset oRecSet = (SAPbobsCOM.Recordset)this.SBO_Company.GetBusinessObject(BoObjectTypes.BoRecordset);
oMatrix = (SAPbouiCOM.Matrix)this.m_SBO_Form.Items.Item(enControlName.mtxDetails).Specific;
SAPbouiCOM.ComboBox oBOQ = default(SAPbouiCOM.ComboBox);
SAPbouiCOM.EditText Project = (SAPbouiCOM.EditText)m_SBO_Form.Items.Item(enControlName.txtPrjCode).Specific;
oBOQ = (SAPbouiCOM.ComboBox)oMatrix.Columns.Item(enControlName.colBOQJCode).Cells.Item(oMatrix.VisualRowCount).Specific;
string SQL = "select U_ITSLBOQCode from qut1 where substring(U_ITSLBOQCode,2,3) = (select U_ITSLcode from OPRJ where PrjCode = '" + Project.Value + "')";
oRecSet.DoQuery(SQL);
if (oBOQ.ValidValues.Count > 0)
{
for (int i = 0; i <= oBOQ.ValidValues.Count; i++)
{
if (Convert.ToString(oBOQ.SelectExclusive(i,BoSearchKey.psk_Index)) != "")
{
}
oBOQ.ValidValues.Remove(0, BoSearchKey.psk_Index);
i = 0;
}
}
oBOQ.ValidValues.Add("", "");
if (oRecSet.RecordCount > 0)
{
oRecSet.MoveFirst();
while (!oRecSet.EoF)
{
oBOQ.ValidValues.Add(Convert.ToString(oRecSet.Fields.Item(0).Value), "");
oRecSet.MoveNext();
}
}
}
catch (Exception ex)
{
//Program.oMainSAPDI.ShowMessage(ex.Message, BoStatusBarMessageType.smt_Error);
}
}
Hope it helps...
Thanks & Regards
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
102 | |
12 | |
11 | |
6 | |
5 | |
4 | |
4 | |
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.