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

Similar Messages

  • 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

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

  • Add New Row in Ok or Update Mode

    Hai,
               I have created new screen by own in UDO. Now my aim is that iam having matrix on that screen on that all are working fine but if i was in Ok or update mode i want to add the last row by default empty.
    Ex:
          While in add mode by default we will set one row as empty rite. Likewise i want in ok mode.
             If anyone have idea post me..........
    Regards,
    Anitha

    Hi Anitha,
    this code is help full to you,
      Sub FormDataEvent(ByRef BusinessObjectInfo As SAPbouiCOM.BusinessObjectInfo, ByRef BubbleEvent As Boolean)
            Try
                If SAPbouiCOM.BoEventTypes.et_FORM_DATA_ADD Or SAPbouiCOM.BoEventTypes.et_FORM_DATA_UPDATE Then
                    If BusinessObjectInfo.BeforeAction = True Then
                        Dim oMatrix As SAPbouiCOM.Matrix
                        oMatrix = CRM_Form.Items.Item("itemgrid").Specific
                        If oMatrix.VisualRowCount <> 0 Then
                            oMatrix.DeleteRow(oMatrix.VisualRowCount)
                            oMatrix.FlushToDataSource()
                        End If
                    End If
                End If
                If SAPbouiCOM.BoEventTypes.et_FORM_DATA_LOAD Then
                    If BusinessObjectInfo.ActionSuccess = True Then
                        CRM_Form.EnableMenu("1282", True)
                        Dim oMatrix As SAPbouiCOM.Matrix
                        oMatrix = CRM_Form.Items.Item("itemgrid").Specific
                        oMatrix.AddRow()
                        oMatrix.FlushToDataSource()
                        Me.SetNewLine(oDBs_Detail.Size)
                    End If
                End If
            Catch ex As Exception
                app.StatusBar.SetText(ex.Message)
            End Try
        End Sub
    Regards,
    Suresh.G

  • 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

  • How to use a single page for create and update mode.

    Hi,
    I need to develop a single page to be used for both create and update modes.
    I am going to use a variable MODE
    and i will set this in the emp summary page.
    Based on the button clicked by the user i have to render the JSF page.
    For tis if the user selects a perticular and cliks on update thn i will pass the empno to the next.
    so there in the next i will appy a ViewCreiteria on my View Obj to fetch only that row so that only that emp will be displayed ion update mode.
    This is working fione for me.
    So now the issue is
    when the user clicks on CreatEmp button.
    i need to enable my VO for insert operations.
    for this i wrote the code like this in the beforePhase event
    FacesContext ctx = FacesContext.getCurrentInstance();
    ValueBinding valBinding = ctx.getApplication().createValueBinding("#{data}");
    BindingContext bContext = (BindingContext) valBinding.getValue(ctx);
    DCDataControl dcControl = bContext.findDataControl("DataControl");
    Application app = ctx.getApplication();
    ApplicationModule am = (ApplicationModule) dcControl.getDataProvider();
    System.out.println("After Appmodule initiation");
    // get the VO reference and initiate the query
    System.out.println("Before Page VO initiation");
    PrismDmPageSectionViewImpl vo = (ViewImpl)am.findViewObject("View");
    //ViewRowImpl row = (ViewRowImpl) vo.createRow();
    /* TO CREATE AN EMPTY ROW*/
    Row row=vo.createRow();
    System.out.println("New Row is created");
    //vo.createKey(row);
    vo.insertRow(row);
    vo.setCurrentRow(row);
    By doing this a new empty page is rendered.
    But when i fill up the values and click on ok.. i am getting the error like this..
    JBO-27023: Failed to validate all rows in a transaction.
    JBO-27027: Missing mandatory attributes for a row with key null of type View3
    JBO-27014: Attribute Id in View3 is required
    JBO-27014: Attribute PageeId in View3 is required
    Please point me out where i am missing.
    Thanks

    Hi,
    In my opinion you are over complicating things.
    This is what I do for using the sme page as both create and update without all this code.
    1) Create a browse page containing a an adf table with a select one component bound to your view object.
    2) Create an additional edit page containing only an edit form containing fields of your view object that your users must enter in order to add or edit rows.
    3) Link the pages in the JSF diagram with an "edit" navigation case from browse to edit page and a "return" navigation case from edit to browse (make sure that redirect option is NOT set on both cases)
    4) Remove the submit button from the edit page and add two application module bindings for the commit and rollback operations as command buttons in the form footer facet. Make sure that both buttons has an action of return and that their disabled property is set to false. You will probably change their labels to ok and cancel respectively.
    5) Drop a create action for your view object from the data control palette inside your page as a command button and set the action property to edit also.
    3) Set the action property of the view button to edit
    This should basically work without any code from your part. -- at least it does so for me -- if you like to make it a bit more funcy you may add am action listener inside your buttons and set a requeScope variable for example #{requestScope.editing} to true or false depending on the button clicked. Then add a title to your page with a value like #{requestScope.editing == true ? 'Editing record' : 'Adding a new record'}..
    Hope that helps.
    Thanassis

  • To find out the last row that is updated in a View Object

    Hi OAF Gurus,
    I have requirement like,
    I have to find out the last row that is updated on a particular View Object and I have send a mail to the users about the change.
    JegSAMassMobVOImpl vo = getJegSAMassMobVO1();
    JegSAMassMobVO is the View Object Name and it displays certain rows that has already been added to the VO in the Page.
    Now the issue is when a user updates a particular row,I have to find which row gets updated and have to send a email to that particular employee about the change.
    Just want to know,how to find out the last updated row in a particular VO.
    Any Help would be appreciated as this a immediate requirement.
    Regards,
    Magesh.M.K.
    Edited by: user1393742 on May 4, 2011 1:06 AM

    Hi Magesh
    It shoud be a Advanced table ,so when user will update the row ,the specific row will fire the PPR and on that event u can capture the row using row reference ,this is the sample code below
    public void processFormRequest(OAPageContext pageContext, OAWebBean webBean)
    super.processFormRequest(pageContext, webBean); OAApplicationModule am =
    (OAApplicationModule)pageContext.getApplicationModule(webBean);
    String event = pageContext.getParameter("event");
    if ("<ItemPPREventName>").equals(event))
    // Get the identifier of the PPR event source row
    String rowReference =
    pageContext.getParameter(OAWebBeanConstants.EVENT_SOURCE_ROW_REFERENCE);
    Serializable[] parameters = { rowReference };
    // Pass the rowReference to a "handler" method in the application module.
    262
    am.invokeMethod("<handleSomeEvent>", parameters);
    In your application module's "handler" method, add the following code to access the source row:
    OARow row = (OARow)findRowByRef(rowReference);
    if (row != null)
    Thanks
    Pratap

  • 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

  • How to count the number of Rows to be Updated before Update takes place..

    Hi all,
    I have a requirement, where i have to count the number of rows to be updated before updating it. SQL%ROWCOUNT gives the no. of rows updated ( after update takes place). How do i get to know the count of no. of rows to be updated/inserted/ deleted. I was looking for a simple solution, as above SQL%Rowcount. But i couldn't find any. I can use a Function and Return the value which will give me number of rows to be updated, But is there any Simple Logic other than this.. or any count function. Your Help is Appreciated. Thanks!

    If you really want to do this (I have no clue why you would need it), then you can piggy back on any existing pessimistic locking you may already have in place.
    However, it would require two loops through the records of which you want to know the count before you update, and a second pass to update them.
    I would really re-think the need for this, though.
    SQL> create table t0304(c number);
    Table created.
    SQL> insert into t0304 select rownum from all_objects where rownum <= 10;
    10 rows created.
    SQL> commit;
    Commit complete.
    SQL> select * from t0304;
             C
             1
             2
             3
             4
             5
             6
             7
             8
             9
            10
    10 rows selected.
    SQL> declare
      2    cursor mycursor is select * from t0304 where mod(c,2) = 0 for update;
      3    i number := 0;
      4  begin
      5    for r in mycursor loop
      6      i := i + 1;
      7    end loop;
      8    dbms_output.put_line(i);
      9    for r in mycursor loop
    10      update t0304 set c = c + 20 where current of mycursor;
    11    end loop;
    12  end;
    13  /
    5
    PL/SQL procedure successfully completed.
    SQL> commit;
    Commit complete.
    SQL> select * from t0304;
             C
             1
            22
             3
            24
             5
            26
             7
            28
             9
            30
    10 rows selected.
    SQL>Edited by: Steve Howard on Mar 4, 2011 5:57 PM

  • 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

  • To Activate the Approval Process when document is in update mode

    Dear Expert,
                        I have applied the Approval Process for UDF using the query "Select Distinct 'True' From ORDR T0
    Where IsNull($[ORDR.U_Rebate.number],0)>0 and $[ORDR.DocType]='I' ".
    Now as the field is UDF user is able to modify even after approval procedure.
    Please help me to apply the above query for the  Approval process even when the document is in update mode.
    regards,
    PankajK

    Dear Pankaj,
    Current B1 design only support approval for adding document. Update will not trigger approval.
    You may use SP_TN instead to block user updating it. If you are not familiar with the SP, search the forum first.
    Thanks,
    Gordon

  • Adding/deleting rows from a treeTable with a read-only view object

    Hello --
    I'm getting a JBO-25016 error when I go to delete a row from a treeTable. I want to create the hierarchy from a stored procedure, have the user add and remove nodes without calling back to the database. I will iterate through the tree and see what has changed and made the necessary updates on the database manually.
    What is the correct method for adding/removing rows form the UI component?
    Thanks!
    Tom

    Thank you, Amit! That did the trick.
    Edited by: Tom on Apr 28, 2011 11:51 AM

Maybe you are looking for

  • I can't get iOS 6.1.1 on my 4th gen ipod touch. It says "Error. Unable to download iOS 6.1.1" Help?

    My iPod 4th Generation does not let me download iOS 6.1.1... The reason I want 6.1.1 is because I want to download kik and a load of other apps but I need 6.1.1.  The message is "Error. Unable to download iOS 6.1.1" or something, and I have no idea w

  • Unable modprobe ndiswrapper on 2.6.12.5 kernel

    Greetings everyone, As my username implies, long time slackware user. Got bored one day and installed Arch and am very impressed. One small problem.  I have using a 2.6.12.5 kernel with a custom .config file that has reiser4 support patched in.  I ha

  • PML parsing problem: Unexpected end of element

    Hi everybody, I'm trying to use Sun's PML-parser (com.sun.autoid.pmlcore.pmlparser.PmlParser) to create an XML file and then parse it again. So my source looks like that: Create:      PmlParser pmlParser = new PmlParser();      ObjectFactory objFacto

  • Trigger oscillosco​pe on specific I2C write?

    Apologies for cross posting this from the Automotive and Embedded forum but there just doesn't seem to be much "traffic" there (no pun intended) I did a search and only found about four posts that even mention I2C. Most are about CAN. My only experie

  • My CS4 is running slow

    My CS4 has started to run very slow for no apparent reason iam running windows xp pro 3.25 G ram and 500G hard disk i was getting a message up saying unknow recorder error and droping a lot of frames while doing a capture This system had been working