Skip to Content
author's profile photo Former Member
Former Member

How to made Matrix columns editable and not editable?

Hi All,

I want to make a matrix columns editable false and true depend on my conditions result.

It is showing an error "Item is not user defined item" in the line **Error**

Can anybody help me to solve this problem?

my coding is as follows

   
If Trim(sValue) = "Y" Or Trim(sValue) = "Yes" Then
            objMatrix.Columns.Item("1").Editable = False
  Else
            objMatrix.Columns.Item("1").Editable = True  ' ***Error***
 End If

Add a comment
10|10000 characters needed characters exceeded

  • private static void Event_ComboSelectAfter(SAPbouiCOM.Form oFrm, SAPbouiCOM.ItemEvent pVal, out bool BubbleEvent)
    {
    BubbleEvent = false;
    SAPbouiCOM.Folder flder;
    SAPbouiCOM.Matrix oMatrix;
    try
    {

    oFrm.Freeze(true);
    CommonUtil.StatoFiltri(false);

    oMatrix.Columns.Item("2007").Visible = true;
    oMatrix.Columns.Item("2007").Width = 50;
    ((SAPbouiCOM.ComboBox)oMatrix.Columns.Item("2007").Cells.Item(pVal.Row).Specific).Active = true;
    ((SAPbouiCOM.CheckBox)oMatrix.Columns.Item("2007").Cells.Item(pVal.Row).Specific).Checked = true;

    }

    catch (Exception ex)
    {

    oFrm.Freeze(false);
    CommonUtil.StatoFiltri(true);

    }

Related questions

5 Answers

  • Best Answer
    Posted on Oct 09, 2008 at 01:24 PM

    Hi,

    you get this error message when you try this in a System Matrix.

    the System Matrix is not a User Defined Item

    -> you can't use Editable = True

    lg David

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Oct 10, 2008 at 04:44 AM

    Hi...

    use this code

    Dim OMat As SAPbouiCOM.Matrix

    Dim OCols As SAPbouiCOM.Columns

    Dim ocol As SAPbouiCOM.Column

    Dim oitem As SAPbouiCOM.Item

    oitem = OForm.Items.Item("Matrix-ID")

    OMat = oitem.Specific

    OCols = OMat.Columns

    ocol = OCols.Item("Column-ID")

    ocol.Editable = False

    ocol = OCols.Item("Column-ID")

    ocol.Editable = True

    Regards..

    Billa 2007

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Oct 14, 2008 at 10:15 AM

    Dear Tamizharasi,

    for system items, you can set a editable one enabled = false, while you cannot set uneditable enable = true.

    it does make sense for protecting default data integrity.

    if in your application, you really need this kind of feature, you can create your own Item, binding with the same datasource which system item binds.

    then, you can set enabled = true or false, as you want.

    Thanks,

    Warren.

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      When I want to "protect" a matrix column from data entry, I use the following code

      to reject input during the "key-down" event in the matrix (using bubble = false).

      I use the B1DE wizard to generate the addon on, so instead of a specific function

      for key down, you might wrap my code in an IF stmt like this:

      (where 3 is the matrix ID on the BOM form, and 4 is the price column):

      if pval.EventType =BoEventTypes.et_KEY_DOWN and pval.ItemUID = "3"
      
             ' Public Overridable Function OnKeyDown(ByVal pVal As ItemEvent) As Boolean
      
                  Try
      
                      Dim form As Form = B1Connections.theAppl.Forms.Item(pVal.FormUID)
                      Dim item As Item = form.Items.Item("3")
                      Dim matrix As Matrix = item.Specific
      
                      If pVal.ColUID = "4" Then
                          B1App.MessageBox("You cannot override component prices.")
                          Return False
                      End If
      
                  Catch ex As Exception
                      B1App.MessageBox(ex.ToString)
                  End Try
      
                  Return True
      
              End Function

  • author's profile photo Former Member
    Former Member
    Posted on Oct 20, 2008 at 11:51 AM

    Hello,

    in SBO 2005A SP01 PL 46 Editable = true works (maybe only with UDF and DBDataSource) :

    ( (Matrix)form.Items.Item("38").Specific ).Columns.Item("U_WREDE_Discount").Editable = true;

    No Error is thrown here.

    (I have to use it after form.Freeze(true) to write some data in this disabled column, after that I switch again to Editable = false and then unfreeze the form. )

    (I'm searching for an solution to set a UDF-column in system matrix as visible and unvisible.)

    Kind regards

    Christian

    ***

    Hello, .... today it doesn't work anymore 😔

    It seems to depend on creating the UDF by code. These new fields were editable for a several time...

    Edited by: Christian Bührig on Oct 21, 2008 5:42 PM

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Oct 23, 2008 at 07:35 AM

    Hi

    If solved this problem so:

    By default I has set matrix columns property Editable=True (editable="1").

    <column uid="e1UQty" type="16" title="Quantity" description="Quantity"
    	visible="1" AffectsFormMode="1" width="91"
    	disp_desc="0" editable="1" right_just="0" val_on=""
    	val_off="" backcolor="-1" forecolor="-1" text_style="0" font_size="-1">
    <databind databound="1" table="@TABLE" alias="U_Qty" />
    <ExtendedObject />
    </column>
    

    After loading the form with the matrix and selectection of data into the matrix, I has set the property Editable of column Qty to True.

    oMatrix.Columns.Item("e1UQty").Editable = True
    

    Regards

    Sierdna S.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.