Skip to Content
0
Apr 22, 2014 at 02:15 PM

Trap the Correct Event to manipulate matrix

23 Views

Hi expert,

another question from me 😊

I need to modify value in a standard form (Quotation Form).

When the user change the "ItemCode" value I want to change the value in some UDF (User Defined Field) in the row.

The UDF i want to change is named "U_II_001"

What is the correct event I have to trap?

Actually I use the event et_CHOOSE_FROM_LIST .

As you can see, if the event is from column "1" (ItemCode) I call two different methods:

1) ReadItemCode

2) AddNewValueInRow

1) return a string value that contains the "ItemCode" value.

This work as well.

Problem is when I call the second method, "AddNewValueInRow"

Program add the new value in the UDF field, but I cannot add new lines just like if the CHOOSE_FROM__LIST action did dot finish:

if (pVal.ItemUID == "38" & pVal.EventType == SAPbouiCOM.BoEventTypes.et_CHOOSE_FROM_LIST & pVal.Before_Action == true)
{
                    // Item Code
                    if (pVal.ColUID=="1")
                    {
                        string oValore;
                        oValore = ReadItemCode(pVal) ;
                        AggiungiValoriNellaRiga(pVal, oValore);
                    }
}


The ReadItemCode code:

        private string ReadItemCode( SAPbouiCOM.ItemEvent pVal )
        {
            SAPbouiCOM.Matrix oMatrix;
            SAPbouiCOM.EditText oValore;

            oMatrix = (SAPbouiCOM.Matrix)oQuotationForm.Items.Item("38").Specific;
            oValore = (SAPbouiCOM.EditText)oMatrix.Columns.Item("1").Cells.Item(pVal.Row).Specific;

            return oValore.Value;
        }

The AddNewValueInRow code:

        private void AddNewValueInRow(SAPbouiCOM.ItemEvent pVal, string oValore)
        {
            SAPbouiCOM.Matrix oMatrix;
            SAPbouiCOM.EditText oDestinazione;
            oMatrix = (SAPbouiCOM.Matrix)oQuotationForm.Items.Item("38").Specific;
            oDestinazione = (SAPbouiCOM.EditText)oMatrix.Columns.Item("U_II_001").Cells.Item(pVal.Row).Specific;
            oDestinazione.Value = oValore;
        }


Now, what i'm doing wrong?

What is the correct event I need to trap?

If i trap the et_VALIDATE event, system freeze...

thanks in advance,

Jonny Cortonicchi