Skip to Content
avatar image
Former Member

Matrix With UDO Datasource


I have been through all the Matrix Samples and read many threads here but I just dont get a few things with the Matrix.

I have created an add on that adds a new folder to the Business Partners Form,

I can have built a matrix in this form and created bound columns bound to my UDO Table @xxxx

I have an event that fires when a business partner is chosen and the folder is only shown when a Customer is selected.

I can even get the matrix to fill with data related to the specific customer only when the customer is selected - using conditions on the DBDataSource.

This is all great but the 2 problems I have are :

I have created a button called Add Row that Adds a Row to Matrix - this button turns into an Update button when the row is added in the Matrix.

Problem 1 : When the row is added in the Matrix it takes the data from the last row of the data and duplicates it in the new row - you can change this data of course however I would like a blank row inserted instead.

Problem 2 : When I update I do a Matrix.FlushToDataSource - then I requery but it has not saved the new entry ?

How do I get the new entry to save into the database.

Any Help would be appreciated.


Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

3 Answers

  • Best Answer
    avatar image
    Former Member
    Oct 18, 2008 at 05:34 AM


    i think u have given buttonUID as '1'.

    remove 1 as uid and assign some other UID

    because 1 is default for Add and 2 is default for Cancel Buttons in SAP B1.

    so, that you can over come changing of caption from addrow to update.

    in update mode if u add a row the new row automatically gets is SAP B1 functionality.

    in order to overcome that

    before adding row to matrix

    Use following code.



    oMatrix.Columns.Item("ColumnUID").Cells.Item(oMatrix.RowCount).Specific.Value="" 'if it is string and numeric type of columns.

    oMatrix.Columns.Item("ColumnUID").Cells.Item(oMatrix.RowCount).Specific.Value="0" 'if it is Double type of columns for eg: Quantity,Rate, Price etc.




    Edited by: Varma on Oct 18, 2008 11:06 AM

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Thanks -

      I didn't have a problem with the button - thanks for your help on the new Row.

      Now how about saving the record.

      the records in the matrix relate only to the currently selected business partner and I am trying to get the column that is U_CARDCODE to be hidden - I still dont understand how to save the newly entered matrix row to the UDO DBDatasouce

  • avatar image
    Former Member
    Oct 18, 2008 at 05:53 AM


    if u dont mind,

    can u send me image of your screen how u r adding.



    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Hi Ani,

      Thanks for the reply, I think I have worked out the the matrix flushtodatasource will not work for me.

      The matrix loads only with records that are related to the current Business Partner so when I add new rows I think I need to :

      My table is called @LYNXS_SPARES

      To do the save I need to



      (Iterate through the Matrix rows)

      So - Have I got it right, and How do I do this easiest and most effectively ?

      My reasoning here is that I think the Matrix is like a blank spreadsheet - you must load into it from a datasource and then dump out of it back into a datasource - thus the flushtodatasource command clears the datasource then relaoads with the contents of the matrix - it is not full-time connected like a .net datagrid - Yes ?


  • avatar image
    Former Member
    Oct 21, 2008 at 05:28 AM


    1.problem u have to give (omatrix.Rowcount)

    2.problem delete udo and again create.


    Billa 2007

    Add comment
    10|10000 characters needed characters exceeded