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

Similar Messages

  • 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

  • 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

  • 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

  • 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 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

  • Add row invoice matrix

    Dear all
    I owe add row in matrix woth different information.
    How ican do?
    Sorry for my english
    Thank's

    First, in sap business one open the 'Fattura in uscita' form, then in menu 'View' set 'Informazioni di debug'.
    Here you can see the column number corresponding to the fields you want to add in the row.
    In your code use this information to insert records in the grid. Here's an example in VB6.
    For i = 1 to 10
    'Codice
    Set c = m.Columns("1").Cells(i).Specific
    c.Value = "Cod" & i
    'Quantità
    Set c = m.Columns("11").Cells(i).Specific
    c.String = "10"
    Next i
    (c is a EditBox, m is the Fattura detail matrix)
    Hope this helps
    Ciao

  • Disable specific Row in Matrix

    Hello ,
    I have created a matrix with two columns :-  Item Code & Qty .If the Qty field is entered then it cannot be changed but i am not able to restrict changing that specific row .Is it possible to disable a single row in matrix .Just like the SAP Forms where once the transaction for specific row is done then it become disable and the remaining rows still become editable..
    Thanks & Regards,
    Amit

    Hi Amit,
    We can't disable row wise in a matrix.  SAP handles that functionality in its default forms, but doesn't exposes the same for UDF's.  We can only disable columns in a matrix.
    I can perhaps suggest you a work around for your functionality.  If the particular row satisfies the conditions for it to be disabled, then, once the user places the focus in the particular cell, then, you can check for the condition in Got_Focus event.  If the disabled condition is satisfied, then, you can push the focus to the last line, and give a message telling that the cell cannot be edited.
    Hope this helps.
    Regards,
    Satish.

  • Deleting a row from matrix by context menu

    Hi all
    does anyone know how can i cause right click on mouse button. on a certain row within a matrix to show a context menu with the option to delete the row. and when pressing the menu item handling the event of deleting the row from the matrix?
    appreciate the help
    Yoav

    Hi Yoav,
    Simply, 'context menu' have to be handled with 'menu event' object.
    It can be done by 'flushToDataSource' method and some tricks.
    Basically, method delete the row without any clause of addon code.
    But it's only can be done in display side.
    If you're using DBDataSource, you have to flush to the datasource.
    I mean, you have to update datasource with the data displayed in the matrix.
    and then, delete the last row of the datasource.
    FlushToDataSource doesn't affect to the number of rows in the datasource.
    You have to delete a row with a method of DBDatasource.. I can't remember the name.
    If, the matrix uses userdatasource, you don't need to delete a row in datasource.
    Because userdatasource doesn't have a concept of 'row', actually.
    Hope this helpful for you.
    Regards,
    Hyunil Choi

  • Display Total Row In Matrix

    Hi all!
    In my addon application I have Matrix with 10 columns (2 columns with column type Edit Text, 8 columns with column type checkbox) now In 8 columns with type checkbox I want to display Footer as form Id = 60207(Menu service/service Report/Response Time by assignee Report). How To do it?
    please give me the solution to display Footer(Total) of Matrix when the column have column type is checkbox.
    Thanks & Help Me

    Hi !
    Thanks for your reply! when using 2 matrixs have problem as follow:
    My Matrix has 10 columns so will appear horizonal scrollbar so it doesn't solved this problem. My Idea I will add row after the last row and display total but i have problem: 8 columns that i want to add total have column type is checkbox so I can't. HOw to convert column type only the my row? Or give me the other solution. THanks
    Edited by: Tao lao on Apr 8, 2008 12:02 PM

  • Collapsible rows in Matrix

    Hello all,
    Is it possible to create a matrix object with collapsible rows like on the standard form "User-Defined Fields - Management"?
    I have found that the Grid has a similar functionality, but it is not exactly the same, because in the Grid each level of nestedness must have a corresponding column, while on the abovementioned SAP form the whole hierarchy is located in the first column.
    Thank you in advance,
    Anton

    Hi,
    I thing It is not possible .in grid its possible. Anyway try like this,
    you have to double click event matrix column write a query in order by.
    Regards,
    Siva

  • Event Select Rows in Matrix

    Hi,
    I'm have one form made in Screen Printer with one matrix. How do you create the event "select row" in a matrix so that when one double-clicks on the row, the informations goes to form on SBO Apllication ?
    For example,
    When you type ' * ' in the ItemNumber field and "Enter" in the form "Item Master Data",  the form " Find (List of Itens)" opens up. This form opens the matrix with all itens and when you double-click on a row  the information of that specific item goes to the Item Mater Data Form.
    The language is C#.
    Could someone help me out?
    Grateful,
    Fabio.

    Hi David,
    Thank you for you answer. But, the question is...how to copy the informations from the fields of my form to the fields SAP form, when the event is to give double-click in row on the matrix of my form.
    sorry my English, but is not another way
    Grateful,
    Fabio.

  • Delete Row In Matrix

    Hello All,
    I have a UDO and a form for it. The UDO has a child table, which is binded to a matrix in the form. Everything works well except Delete Row in the matrix.
    If I don't do anything when Delete Row menu is clicked, the row is deleted. But as soon as Update button is clicked, a new empty row gets added to the matrix and the underlying table.
    The same happens even if I catch the delete row event, do the delete myself and then set the bubbleevent to false.
    Is this the default behaviour. What is the workaround to avoid this addition of new empty row.
    Following is the code I am using for deleting the row. I've used various combinations of this code to the same affect.
            Dim oMatrix As SAPbouiCOM.Matrix
            Dim RowIndex As Integer
            Try
                If oForm.Mode <> SAPbouiCOM.BoFormMode.fm_FIND_MODE Then
                    oMatrix = oForm.Items.Item("AC_MX01").Specific
                    RowIndex = oMatrix.GetNextSelectedRow
                    If RowIndex <= 0 Then
                        Exit Sub
                    End If
                    oForm.DataSources.DBDataSources.Item("@AC_SMP1").RemoveRecord(RowIndex - 1)
                    oMatrix.DeleteRow(RowIndex)
                    'oMatrix.FlushToDataSource()
                    'oMatrix.LoadFromDataSource()
                Else
                    Exit Sub
                End If

    Hi Rahul
    Try this code
            Dim oMatrix As SAPbouiCOM.Matrix
            Dim RowIndex As Integer
            oMatrix = oForm.Items.Item("AC_MX01").Specific
            For RowIndex = 1 To oMatrix.RowCount
                 If oMatrix.IsRowSelected(RowIndex) = True Then
                     oMatrix.DeleteRow(RowIndex)
                     oMatrix.FlushToDataSource()
                     If form.Mode = 1 Then form.Mode = BoFormMode.fm_UPDATE_MODE
                     Exit For
                 End If
           Next
    Hope this helps....
    Kind Regards
    Arun TB

  • 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

  • Add Row in Matrix by pressing "Alt" button in last cell of matrix

    Hello All,
    I want to enable the rows of the matrix by pressing "Alt" in the last column so that the next row get enabled instead of
    pressing the "Add Line" Button every time.
    I have done it by pressing "Tab" using pval.charpressed="9"
    But i want to do it by pressing "Alt" key is this posible.
    Please share the code or suggest any way to do it .
    Thanks & Regards,
    Amit

    Hi Amit,
    Only Tab, Enter, Escape, Delete and Back Space are available to charpressed. Alt button has no equivalent coding.
    Thanks,
    Gordon

Maybe you are looking for