cancel
Showing results for 
Search instead for 
Did you mean: 

Custom value in matrix

Former Member
0 Kudos
57

I want to set the total in a delivery document, so I have this code:

if (EventEnum == SAPbouiCOM.BoEventTypes.et_LOST_FOCUS && pVal.ItemUID.Equals("Rental") && pVal.FormTypeEx.Equals("140"))
                {
                    form = SBO_Application.Forms.Item(pVal.FormUID);
                    form.DataSources.DBDataSources.Add("OITM");
                    SAPbouiCOM.Matrix matrix = (SAPbouiCOM.Matrix)form.Items.Item("38").Specific;

                    SAPbobsCOM.Recordset rs = (SAPbobsCOM.Recordset)SBO_Company.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset);

                    int daysQtt = int.Parse(((SAPbouiCOM.EditText)form.Items.Item("Rental").Specific).String);

                    for (int i = 1; i < matrix.RowCount; i++)
                    {
                        String s1 = ((SAPbouiCOM.EditText)matrix.Columns.Item("1").Cells.Item(i).Specific).Value;
                        String unitPrice = ((SAPbouiCOM.EditText)matrix.Columns.Item("14").Cells.Item(i).Specific).Value;
                        float preco = parsePrice(unitPrice);
                        string sSQL = "SELECT U_rentable FROM OITM WHERE ItemCode = '" + s1 + "'";
                        rs.DoQuery(sSQL);
                        rs.MoveFirst();
                        SAPbobsCOM.Field f = rs.Fields.Item(0);
                        double finalPrice = 0;
                        if (f.Value.Equals("2") || f.Value.Equals("Y"))
                        {
                            finalPrice = daysQtt * preco;
                            //Fails in the next line
                            ((SAPbouiCOM.EditText)matrix.Columns.Item("21").Cells.Item(i).Specific).String = daysQtt.ToString();
                        }
                    }                    
                }

I don't understand why I can't change the value because in the sales order I'm able to...

Is there any kind of restriction or something?

Thanks in advance

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

I hope u r getting error like

Form Bad value or item is not editable...?

I think value is getting into cell after that exception is coming right..?

Catch error like this...

Try
((SAPbouiCOM.EditText)matrix.Columns.Item("21").Cells.Item(i).Specific).String = daysQtt.ToString();
catch Exception
//Do Nothing
End Try

By

Firos