Adding a row in Matrix

Hi,
I have a Form having matrix, and it is bind with 2 UDT Tables. One of 'Master Type' and Other is 'Master Data Lines'.
All the operation 'ADD,UPDATE,FIND,DELETE, ADD ROW' and the operation for Navigation Buttons are working fine.
But when I navigate to any previous record,following problem arises :
1. When i add row to matrix it copies data from the previous row.
2. Now after 1st operation i change the newly added row , due to this form goes in Update mode.It is also fine.But when i press the Update Button i get the message records updated successfully, but the problem is newly added row in the matrix does not inserted in DataBase
I need the solution for both problems.
Thanks in advance.

Here some sample I used to test it:
Case SAPbouiCOM.BoEventTypes.et_KEY_DOWN
                        Dim l_Mat As SAPbouiCOM.Matrix
                        l_Mat = oForm.Items.Item("Matrix2").Specific
                        If pVal.CharPressed = 13 And (pVal.Row = l_Mat.RowCount) Then
                            Dim _UDSS As SAPbouiCOM.UserDataSources
                            ' Clear the UDS before adding a new line
                            _UDSS = oForm.DataSources.UserDataSources
                            UDSS.Item("UDSCode").ValueEx = ""
                            UDSS.Item("UDSName").ValueEx = ""
                            UDSS.Item("UDSPhone").ValueEx = ""
                            l_Mat.AddRow()
                        End If
If you are using DBDatasources is easier (1st post)
Regards,
Felipe

Similar Messages

  • Adding new row in matrix

    Dear all,
    I press right-click on Journal Entry and select "Cancel" function.
    SAP B1 creates a new journal entry with inverted rows registration.
    Now, I added a new button in this form.
    When I press the button, I need to add a new empty row in the matrix.
    I use this command:
    oJEMatrix.AddRow()
    I also used this command:
    oJEMatrix.AddRow(1, 1)
    but what I obtain is a new row with the same values of the first row (it seems a duplication of the first row).
    The new row-index (first left column) in the matrix has the value "1" as the first original row.
    How can I add a new empty row in this matrix and refresh the matrix to update the index of each row?
    Best regards
         Emanuele

    I found the error:
    I was trying to set Credit > 0 and Debit > 0 on the same row.
    But now I have a nother issue with matrix.
    See image below...
    After populating the matrix, the rows index are incorrect. How can refresh the matrix to recalculate the correct row number in the first column?
    Best regards
        Emanuele

  • Adding a row in matrix[Update Mode]

    Hi All,
    I am using a document type table, which has a matrix and i have created the UDO for dis. in Add mode its working properly. In update mode also its working properly but when i add a new row in the matrix its displaying the previous rows data n if i empty the fields and i tried to update then its showing the error like "This entry already exists in the following tables (ODBC -2035)  [Message 131-183]" .pls provide a solution for this.
    Regards,
    Vijay Kumar.

    Hi Vijay,
    You Can try this Code:
    oDBDataSource.Clear();
                                oMatrix.AddRow(1, oMatrix.RowCount);
    Here I am assuming that the matrix is bind with the DBDatasource.
    The whole point is that you have to Clear the Datasource before adding the new row, otherwise it will pickup the last supplied value from the Datasource.
    HTH
    Prashant Bansal

  • Adding a row to matrix.....

    hi all,
    i am unable t o add a new row to a matrix.
    i have made a form by using screen painter with different items (for ex. buttons, edit text, matrix etc..)
    when  i load a form, i got matrix with non editable fields...
    thanxs in advance.
    nirdesh

    You have to call "oMatrix.AddRow()" to add a row and then be able to input data into the matrix.
    Example :
            Dim oMatrix As SAPbouiCOM.Matrix
            oMatrix = CType(SBOApp.Forms.Item(MyFormUID).Items.Item("MyMatrixUID").Specific, SAPbouiCOM.Matrix)
            oMatrix.AddRow()
    nb: you have ton bind all the columns to userdatasources or dbdatasources.
    Choose dbdatasources if your matrix has to be linked to 1 table. Choose userdatasources else.

  • Re:Adding a row in a matrix using Lost_Focus event & deleting a row

    Dear All,
    Iam facing a problem in adding a row in a matrix using last focus event.its like if i keep the cusor in the last coloumn in a matrix n if i press tab it should add a row .the row is getting added the problem here is the cursor is gng to first row but it should come to the second row.
    the second problem is while deleting a row the row is getting deleted but the row count is showing the deleted row no.
    pls suggest a solution for these problems.
    Thanks & Regards
    Anand

    Hi,
    If pVal.BeforeAction = False Then
                Select Case pVal.EventType
                    Case SAPbouiCOM.BoEventTypes.et_KEY_DOWN
                        If pVal.ItemUID = "matlab" And pVal.ColUID = "mtimeout" And pVal.CharPressed = 9 Then
                            oMatrix = oForm.Items.Item("matlab").Specific
                            Dim rc As Integer = oMatrix.VisualRowCount
                            If rc = pVal.Row Then
                                addrow()    'funtion for adding row
                                oMatrix.Columns.Item("labc").Cells.Item(oMatrix.RowCount).Click()
                                'SBO_Application.MessageBox(oMatrix.RowCount)
                            End If
                        End If
    This is the function i hav used
    Private Sub addrow()
            Try
                If (oForm.UniqueID = "updt") Then
                    oForm = SBO_Application.Forms.ActiveForm
                    oForm = SBO_Application.Forms.Item("updt")
                    omatrix = oForm.Items.Item("matlab").Specific
                    omatrix.AddRow(1, omatrix.VisualRowCount)
                    Dim rc As Integer = omatrix.VisualRowCount
                    'SBO_Application.MessageBox(rc)
                    otext1 = omatrix.Columns.Item("mdatein").Cells.Item(rc).Specific
                    otext1.String = "s" 'RecSet.Fields.Item("date1").Value
                    otext1 = omatrix.Columns.Item("mdateout").Cells.Item(rc).Specific
                    otext1.String = "s" 'RecSet.Fields.Item("date1").Value
                    End If
            Catch ex As Exception
                SBO_Application.MessageBox(ex.Message)
            End Try
        End Sub
    this is the code which m using
    Regards,
    Anand

  • Deleting row in matrix.

    Hello.
    I have weird problem.
    If I add some rows to matrix, and then delete rows the method with:
    m_pMatrix->GetRowCount();
    return the number of rows without delete.
    For example:
    If i have matrix with 5 rows, and I delete 2 rows, method with GetRowCount show me 5
    What is wrong ?
    I solved this problem with adding new variable, but why does it work wrong ?
    Sorry for my english.
    Regards
    Kamil Wydra

    Hello.
    Thank You for Your response.
    I try that and it works.
    Thanks again.
    Regards
    Kamil Wydra

  • Self-coping row in matrix

    Hey All
    I hava problem with AddRow to Matrix because after add row to Matrix, added row is copy of previous
    I use this code:
    Matryca.AddRow(1, -1)
    Matryca.Columns.Item(1).Cells.Item(i + 1).Click SAPbouiCOM.BoCellClickType.ct_Regular)
    Thanks very much for answers
    regards
    Krzysztof Sala

    Thanks
    it run
    I use:
    i = pVal.Row()
    DBDS1.InsertRecord(i)
    Matryca.LoadFromDataSource()
    Matryca.Columns.Item(1).Cells.Item(i + 1).Click SAPbouiCOM.BoCellClickType.ct_Regular)
    regards
    Krzysztof Sala

  • Re: Add Row in Matrix

    Hi All,
    I want to add a row in matrix by clicking the Add Row option by right clicking on the matrix. If the form has one matrix means its working well. But if the form has more than one matrix if i activate the Add Row menu and write the code in the MenuEvent i am not able to give the ItemUID so if i add row in any of the matrix one row is added in all the matrix. How can i solve the problem.
    Thanks in Advance.
    Regards,
    Madhavi.

    Hi Madhavi,
    save the position and and the itemuid in a variable.
    use the et_GOT_FOCUS event for this - than you know always in which matrix
    and position you're standing.
    use the variables in the et_MENU_EVENT to add the row in correct matrix and position
    lg David

  • BI-IP - Bex Analyser - Adding colums / rows in workbooks

    Hi experts,
    In BI-IP (BW 7) in Bex Analyser we are facing the following problem:
    In the workbook if the user inserts a column nearby the input ready columns and inputs values at the time of transfer / save values, the system automatically copies these values to the next input column. The same if they insert rows and add values, at the time of transfer values the system deletes the row but adds the values in the above row.
    Is it how Bex Analyser (workbook) works or we are having a problem?
    Thanks and regards,
    MA
    Edited by: Maria Almeida on Apr 30, 2008 1:16 AM
    Edited by: Maria Almeida on Apr 30, 2008 1:17 AM

    Hi Maria,
    Please do not take it offesive.
    The issue you guys are encountering is due to lack of Training to Users.
    Planning is an intelligent activity. Planners are expected to do their home work before they embark on planning and layouts help capturing values in an orderly manner.
    It would be wonderful if you restrict the access to queries, else train the users on the impact and relevance.
    As you are aware adding a row is possible in WAD.
    Regards
    Srinivas

  • Adding Columns to the matrix in SAP B1 user form using Visual studio 2010

    Hi,
    Using Visual studio 2010, I have created a SAP B1 user form( b1f ) with one matrix.Matrix is having 5 columns. Its working properly. Later, I want to add few more columns. Then I added columns to the matrix as I have created columns initially. But, it does not saves.
    i.e, Whenever I run, In B1 I could see only old columns. Newly created columns are not showing.So, I closed the .net project and opened again. Created columns are not showing in visual studio b1f itself. So, I created again and saved. But, its not saving.I tried it many times.
    What I am missing?
    Any help is appreciated.
    Thanks in advance,
    Parvatha Solai.N

    Hi Parvatha,
    Are you using B1 Studio? Anyway try to clean the solution first then rebuild it. This would re-copy files to the output directory, that contain your changes.
    Best regards,
    Pedro Magueija

  • Add row in matrix

    hello expert
    i want to know how to add row in matrix as like in SAP b1.i create the code to add row in matrix by button but this is so many time consuming for end user due to this i want to add row functionality automatic as like SAP B1.so pls help me sir for this
                                                                                    thanx a lot

    Hi
    you can add row in matrix on lost focus of a column
    Regards

  • Adding/removing rows in TABLEVIEW

    Hi. I've got a TABLEVIEW in one of my subscreens. But when load itab into that tableview with 'LOOP AT...'  tableview appears but I can't add rows to it. I can't delete existing rows too. What should I add to my programm to have possibility of adding/removing rows from my tablewiev? Greetings. P.

    Hi Friend,
    To add/delete rows in your table view.
    You have to add/delete rows from internal table fro where you are displaying values.
    You have to write code in PAI..
    In LOOP ... ENDLOOP check the OK_CODE if it is ADD (for eg.) you have to add a blank row to internal table by just passing a blank work area.
    And if it is DELETE (for eg.) delete the row of that index (TABLEVIEW-CURRENT_LINE)...
    for these two excersies you have to readjust lines of tableview...after taking number of lines from internal table (DESCRIBE TABLE INT_EX LINES WS_LINES
    TABLEVIEW-LINES = WS_LINES) write this piece of code in Intialization.
    Hope it will solve the problem.
    Regards
    Krishnendu

  • Delete Last Row in Matrix on SBO 2005

    Hi,
    Im using SAPB1 2005 SP1 with B1DE.
    I've seen a post that indicates that the following code should delete a row from a matrix (even the last row) when using SBO 2005
    I still find that all rows except last row of matrix are removed from the database.
    <b>How do I delete the last row from the Del button event handler????</b>
    I'm using
    <i>        [B1Listener(BoEventTypes.et_CLICK, false)]
            public virtual void OnAfterClick(ItemEvent pVal)
                bool ActionSuccess = pVal.ActionSuccess;
                Form form = B1Connections.theAppl.Forms.Item(pVal.FormUID);
                Item item = form.Items.Item("del");
                Button button = ((Button)(item.Specific));
                // ADD YOUR ACTION CODE HERE ...
                int row;
                Matrix oMtx = (Matrix)form.Items.Item("mtx_0").Specific;
                DBDataSource oDBDS = (DBDataSource)form.DataSources.DBDataSources.Item("@SD_POOLCONTRCT_LINE");
                row = oMtx.GetNextSelectedRow(0, BoOrderType.ot_SelectionOrder);
                oMtx.DeleteRow(row);
                if (oMtx.RowCount == 0)
                    oDBDS.RemoveRecord(0);
                if ((form.Mode != BoFormMode.fm_ADD_MODE) | (form.Mode != BoFormMode.fm_UPDATE_MODE))
                    form.Mode = BoFormMode.fm_UPDATE_MODE;
                }</i>

    Hi Ben,
    [B1Listener(BoEventTypes.et_CLICK, false)]
    public virtual void OnAfterClick(ItemEvent pVal)
    bool ActionSuccess = pVal.ActionSuccess;
    Form form = B1Connections.theAppl.Forms.Item(pVal.FormUID);
    Item item = form.Items.Item("del");
    Button button = ((Button)(item.Specific));
    // ADD YOUR ACTION CODE HERE ...
    int row;
    Matrix oMtx = (Matrix)form.Items.Item("mtx_0").Specific;
    DBDataSource oDBDS = (DBDataSource)form.DataSources.DBDataSources.Item("@SD_POOLCONTRCT_LINE");
    Rest of your code will remain same.
    I am making the modification here. I am using the RowCount property that gives me the address of the last row of the matrix.
    <b>row = oMtx.RowCount;</b>
    Every time this will return you the last row and that row will be deleted.
    <b>row = oMtx.RowCount;</b>
    oMtx.DeleteRow(row);
    if (oMtx.RowCount == 0)
    oDBDS.RemoveRecord(0);
    if ((form.Mode != BoFormMode.fm_ADD_MODE) | (form.Mode != BoFormMode.fm_UPDATE_MODE))
    form.Mode = BoFormMode.fm_UPDATE_MODE;
    Regards,
    Prashant

  • Adding a Row to Table, ComboBox as a  TableCellRenderer Problem !!

    Hell All:
    I have a JTable with one of the Cell as ComboBox. Initially I draw the JTable with Three Rows and the
    the ComboBox in the Second Column works fine. I see each comboBox has different Items. The ComboBox also has a Renderer (as I am customizing the Item's Text )
    Here is the snippet from my Code.
    ==========================
    // UIEditSubAllocation.ALT_ACCOUNT = 2;
    // Get the Viewindex.... to get the correct column
    int viewIndex = this.m_suballocTable.convertColumnIndexToView(UIEditSubAllocation.ALT_ACCOUNT);
    // get the Table Column...
    TableColumn altActColumn = this.m_suballocTable.getColumnModel().getColumn(UIEditSubAllocation.ALT_ACCOUNT);
    // Create Three ComboBox..
    JComboBox[] altActCell = new JComboBox[3];
    for (int i =0;i< 3;++i) // adding Three Rows of Table Data...
    String [] alternateAccounts = new String[4];
    for(int j = 0; j < alternateAccounts.length; j++) // Each Alternate Accounts i.e combobox has 4 items..
    alternateAccounts[0] = "Tom";
    alternateAccounts[0] = "Vic";
    alternateAccounts[0] = "Tracy";
    alternateAccounts[0] = "Andy";
    altActCell[i] = new AltAccountComboBox(alternateAccounts,this.m_suballocTable);
    } // End of adding Three Rows
    altActColumn.setCellRenderer(new AltAccountTableCellRenderer());
    if (viewIndex >= 0)
    ComboBoxEditor altActCellEditor = new ComboBoxEditor(altActCell);
    altActColumn.setCellEditor(altActCellEditor);
    The CombBoxEditor code is...
    ublic class ComboBoxEditor extends DefaultCellEditor
    * Constructs a ComboBoxEditor that uses an array of items of type object.
    * @param items - an array of items of type object
    public JComboBox[] m_comboBox;
    public ComboBoxEditor(JComboBox[] box)
    super(box[0]);
    m_comboBox = box;
    for(int i = 0; i < box.length; i++)
    m_comboBox.setEditable(false);
    public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column)
    if(row >= this.m_comboBox.length)
    return super.getTableCellEditorComponent(table, value, isSelected, row, column);
    return m_comboBox[row];
    But when I click a Button (in a Panel) which adds a Row (with No values for the ComboBox ).. to the Jtable .. The Row Gets added fine.. but the JComboBox comes with Values from the First Row's ComboBox. I Don't want any Values in the JComboBox for the new added Row. Can someone tell me
    how do I remove the Items from the ComboBox.
    I will really appreciate for any help...
    Thanks
    -Pankaj

    Hi ,
    as per my opinion one approach would be that ,
    you create a custom table region same as standard one using Jdeveloper and create other required fields also using jeveloper ,and then put this region in extend property of existing standard table region .
    thanks
    Pratap

  • Can iOS Numbers copy formulas when adding new rows?

    iOS Numbers table add row is not copying previous cell formulas. Is this supported or not?
    I have a table with lots of columns and all of them have formulas. When I click at the lower left of the table to add a row, none of the new cells have the formulas. I have to manually go through every column and copy the formulas to the new row.
    This is not very practical if you're planning to use Numbers on the go with an iPad. In my case, I have to quickly get a new row ready as needed. I was hoping there is a preference setting somewhere like "copy formulas when adding new row".

    I had the same issue with the added twist that I wanted to reference the created cells in formulas in other sheets. This is what works for me:
    I use a form to enter data. The referenced sheet is set up like this:
    1     Name     Date     ServPayment    SalesPayment     Total
    2     Week1                                                                 =sum (ServPayment,SalesPayment)
    3                                                                                =sum (ServPayment,SalesPayment)
    4     TotWeek1                                                            =sum (Total2,Total3)
    "Total" sums the 2 Payments, TotWeek1 sums the totals.
    In the entry form I never add data to the empty line. In this example, I would start at "Week1" and tap the "+" to add a new form. This creates the line in the referenced sheet with my formulas. As I continue, I always start at the last entry I have made and tap "+".
    When I create a line that does not have the formula on either side, I do not get the formula.
    Hope this helps.

Maybe you are looking for