Matrix addrow

Hi
I have a simple form. As soon as i click Addrow button i need to add a row in the matrix.  I have opened the form first time and clicked addrow buttond a new row is getting added into the matrix. Now i have clicked the cancel button in the form. And then i reopened the form again when i click addrow button 2 new rows are getting added. but i need to add only single row.
Please let me know the solution. i have given the sample code for your reference.
Private Sub SBO_Application_ItemEvent(ByVal FormUID As String, ByRef pVal As SAPbouiCOM.ItemEvent, ByRef BubbleEvent As Boolean) Handles SBO_Application.ItemEvent
If (FormUID = "Frm_QTENT1") Then
                If (pVal.Before_Action = False) Then
                    If (pVal.ItemUID = "Addrow") And (pVal.EventType = SAPbouiCOM.BoEventTypes.et_CLICK) Then
                        Dim f As SAPbouiCOM.Form
                        Dim oMatrix As SAPbouiCOM.Matrix
                        f = SBO_Application.Forms.Item(FormUID)
                        oMatrix = f.Items.Item("mat1").Specific
                        f.DataSources.DBDataSources.Item(1).Clear()
                        oMatrix.AddRow(1)
                    End If
                End If
            End If
End sub
You can also test . Just add a matrix to a form and then add one button. In the itemevent just past the code above and run the form. And then click addrow button
you can see a new row is added into the matrix. When cancel the form. And now open the form again now click add button only once. You can see 2 rows are getting added. The code what is pasted will be fired 2 wise .
Please let me know how can i solve this problem.
If any one able to solve this problem i will give full reward points
regards
Suresh

hi,
Still i am facing the same problem. I have given the comple code. please let me have a solution for the same. When i click next sample i need to populate all the parameter for the item in the matrix. for that i have writtern the code. It works fine still i did not click cancel button. But as soon as i click cancel button and add click next sample button multiple time this item is getting fired and row are getting add for the time which i have added first time.
If (pVal.EventType = SAPbouiCOM.BoEventTypes.et_ITEM_PRESSED) And (pVal.ItemUID = "nextsample") Then
                        Dim oEdit As SAPbouiCOM.EditText ' Sample no
                        Dim oEdit1 As SAPbouiCOM.EditText ' Para code
                        Dim oEdit2 As SAPbouiCOM.EditText ' Para desc
                        Dim oEdit3 As SAPbouiCOM.EditText ' UOM Code
                        Dim oEdit4 As SAPbouiCOM.EditText ' UOM Name
                        Dim oEdit5 As SAPbouiCOM.EditText ' Standard Value
                        Dim oEdit6 As SAPbouiCOM.EditText ' Tollerance Pluse
                        Dim oEdit7 As SAPbouiCOM.EditText ' Tollerance minus
                        Dim i As Integer
                        Dim k As Integer
                        Dim sSQL As String
                        Dim oDocRec As SAPbobsCOM.Recordset
                        samno = samno + 1
                        txtsamno.Value = samno
                        oDocRec = Ocompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)
                        sSQL = "select b.U_paracode,b.U_paradesc,b.U_UomCode,b.U_uom,b.U_value,b.U_tollplus,b.U_tollmins from [@PSSIT_QCSTANDHDR1] a,  [@PSSIT_QCSTANDDTL1] b where a.U_itemcode = '" & cbogrp.Selected.Value.ToString() & "' and a.Code = b.Code"
                        'sSQL = "select b.U_paracode,b.U_paradesc,b.U_UomCode,b.U_uom,b.U_value,b.U_tollplus,b.U_tollmins from [@PSSIT_QCSTANDHDR1] a, [@PSSIT_QCSTANDDTL1] b where a.U_itemcode = '" & oForm.DataSource.UserDataSource.Item("ItemCode").ValueEx & "' and a.Code = b.Code"
                        oDocRec.DoQuery(sSQL)
                        Oform.Freeze(True)
                        '**********8
                        Dim f1 As SAPbouiCOM.Form
                        Dim oDBs As SAPbouiCOM.DBDataSource
                        f1 = SBO_Application.Forms.Item(FormUID)
                        oMatrix = f1.Items.Item("mat2").Specific
                        oDBs = f1.DataSources.DBDataSources.Item("@PSSIT_QCDTL1")
                        oDBs.Clear()
                        Omatrix.Clear()
                        '  If RefFlag = False Then
                        Omatrix.AddRow(1)
                        If oDocRec.RecordCount > 0 Then
                            For i = 0 To oDocRec.RecordCount - 1
                                'MessageBox.Show(oDocRec.RecordCount)
                                ' Omatrix.AddRow(1)
                                'Sample no
                                oEdit = matcol1.Cells.Item(totrow).Specific
                                oEdit.Value = CInt(samno)
                                matcol1.Editable = False
                                'Parameter code
                                oEdit1 = matcol2.Cells.Item(totrow).Specific
                                oEdit1.Value = oDocRec.Fields.Item(0).Value
                                matcol2.Editable = False
                                'Parameter Name
                                oEdit2 = matcol3.Cells.Item(totrow).Specific
                                oEdit2.Value = oDocRec.Fields.Item(1).Value
                                matcol3.Editable = False
                                'UOM Code
                                oEdit3 = matcol4.Cells.Item(totrow).Specific
                                oEdit3.Value = oDocRec.Fields.Item(2).Value
                                matcol4.Editable = False
                                'UOM Name
                                oEdit4 = matcol5.Cells.Item(totrow).Specific
                                oEdit4.Value = oDocRec.Fields.Item(3).Value
                                matcol5.Editable = False
                                'Standard Value
                                oEdit5 = matcol6.Cells.Item(totrow).Specific
                                oEdit5.Value = oDocRec.Fields.Item(4).Value
                                matcol6.Editable = False
                                'Tollerance Pluse
                                oEdit6 = matcol7.Cells.Item(totrow).Specific
                                oEdit6.Value = oDocRec.Fields.Item(5).Value
                                matcol7.Editable = False
                                'Tollerance minus
                                oEdit7 = matcol8.Cells.Item(totrow).Specific
                                oEdit7.Value = oDocRec.Fields.Item(6).Value
                                matcol8.Editable = False
                                oDocRec.MoveNext()
                                If oDocRec.EoF = True Then
                                    totrow = totrow + 1
                                    Oform.Freeze(False)
                                    Exit For
                                End If
                                totrow = totrow + 1
                                Omatrix.AddRow(1)
                            Next i
                            Oform.Freeze(False)
                        Else
                            MessageBox.Show("Parameter is not updated for this item")
                        End If
                    End If

Similar Messages

  • Matrix.AddRow "eats" rows

    Hello
    I'm trying to do sorting on matrix object. I'm almost there but there is small problem. Here is the code
                    for (int i = 0; i < dbDataSource.Size; i++)
                        dbDataSource.Offset = sortedList<i>.Idx;
                        matrix.AddRow(1, ++i);
    every time I fire double click event (which contains sorting code) my matrix will show less and less items until it becomes blank.
    If it helps somehow I'm posting code which I use for actual sorting.
                if (pVal.ColUID == "col_dost")
                    matrix.Clear();
                    List<Dostawca> dostawcy = new List<Dostawca>();
                    DBDataSource dbDataSource = form.DataSources.DBDataSources.Item("@CT_PRP1");
                    int count = dostawcy.Count;
                    int k = 0;
                    for (int i = 0; i < dbDataSource.Size; i++)
                        string sValue = dbDataSource.GetValue("U_CardName", i);
                        Dostawca dostawca = new Dostawca();
                        dostawca.Nazwa = sValue;
                        dostawca.Idx = k;
                        dostawcy.Add(dostawca);
                        k++;
                    var sortedList = dostawcy.OrderBy(x => x.Nazwa).ToList();
                    for (int i = 0; i < dbDataSource.Size; i++)
                        dbDataSource.Offset = sortedList<i>.Idx;
                        matrix.AddRow(1, ++i);
    and here is my "Dostawca" class
        public class Dostawca
            private string _nazwa;
            private int _id;
            public Dostawca() { }
            public string Nazwa
                get
                    return _nazwa;
                set
                    _nazwa = value;
            public int Idx
                get
                    return _id;
                set
                    _id = value;
    Thanks
    Kamil

    Ok, never mind. I see the problem.

  • Matrix addrow problem

    I want to enter some value in a matrix
    I enbled matrix with
    oMatrix.AddRow()
    but problem is
    that - when I am inputing data in matrix fields , after pressing tab the value disappears
    how can I resolve the problem?

    thts because your matrix's columns are not bound with any user or DB datatsource. alternatively , you will have to bind it with the columns of table to which you are saving the data.
    regards,
    Binita

  • How to set default value in matrix column

    Hi all,
    Does any one know how to set a default value in matrix column ?. I just want , when an event right click and add row. so i set a default value in a column field for example 'Test'. FYI the matrix is in the UDO.
    so my code will be like this
    If pVal.ItemUID = "Matrix" And pVal.MenuUID = "1292" Then
                        Try
                            Dim oColumn As SAPbouiCOM.EditTextColumn
                            Dim matrix As SAPbouiCOM.Matrix
                            matrix = oForm.Items.Item("Matrix").Specific
                           oColumn = mat.Columns.Item("Code").specific
                            oColumn.Value = "Test"
                        Catch ex As Exception
                            Debug.Print(ex.Message)
                            Debug.Print(ex.ToString)
                        End Try
                    End If
    I have run it and when i right click and add row it still can not set the default value in one of the matrx column.
    does any one know how to solve it. thanks in advance

    Hi Bodhi
    Sandeep is right you can set value using SetValue() function
    If pVal.ItemUID = "Matrix" And pVal.MenuUID = "1292" Then
                        Try
                            Dim matrix As SAPbouiCOM.Matrix= oForm.Items.Item("Matrix").Specific
                            oForm.DataSources.DBDataSources.Item("UDT").Clear()
                            matrix .AddRow()
                            matrix .FlushToDataSource()
                            With form.DataSources.DBDataSources.Item("UDT") 
                                    .SetValue("UDF", matrix .RowCount - 1, "Test")
                            End With
                            matrix .LoadFromDataSource()
                        Catch ex As Exception
                            Debug.Print(ex.Message)
                            Debug.Print(ex.ToString)
                        End Try
    End If

  • How to insert an empty row on a matrix with multiple loaded lines?

    Hi.
    I want to insert an empty row on my form's matrix. Currently I am using the <b>AddRow </b>method, as it is:
    // C# - it's mandatory to give parameters to the method (=
    oMatrix.AddRow(1,1)
    But, when the matrix already has some rows (at least 1), the method <b>AddRow </b>inserts the new line as a copy of above line, then, I have to manually clear all cells.
    Any idea on this?
    Thanks in advance.

    If you matrix is bound to a dbDatasource you can insert a record in the dbdataspurce instead of using matrix.AddRow... If not only way to do it is by clearing the row after add

  • How to fill matrix with the output of recordset query?

    Hi all,
    I want a user matrix to load data when I hit a button and the data to be filled is the output of an sql query. binding the matrix columns with table columns and then load the matrix with DBDatasource attached to that table will not do in this case as the columns in the sql query are from several different tables or views. 
    writing following line to do this takes several minutes to load the data:
    For j = 0 To Reordset.RecordCount - 1
    Matrix.AddRow()
    Matrix.Columns.Item("col1").Cells.Item(i).Specific.value =  Recordset.Fields.Item("cardcode").Value
    Recordset.movenext()
    next
    Is there any other way to fill the matrix in this case, which loads the data faster?
    Regards,

    Hello Binita,
    I've tested the CFL for DataTable-Matrixes in my test-AddOn. But there's still one problem left. Maybe you find it out (I will need this in the future too...).
    The ChooseFromList must be added behind the DataTable-Bind, which is done on every MTX-Load (it's not from the sample above, so the UIDs are new ones):
                oDt = oDts.Item("dt_test")
                query = "SELECT  * FROM [@T_CONVTOOLS01]"
                oDt.ExecuteQuery(query)
                oMtx.Columns.Item("0").DataBind.Bind("dt_test", "Code")
                oMtx.Columns.Item("1").DataBind.Bind("dt_test", "U_Alpha01")
                oMtx.Columns.Item("2").DataBind.Bind("dt_test", "U_Price01")
                oMtx.Columns.Item("3").DataBind.Bind("dt_test", "U_Quant01")
                oMtx.Columns.Item("4").DataBind.Bind("dt_test", "U_Date01")
                AddChooseFromLists()
                oMtx.LoadFromDataSource()
    ...where AddChooseFromLists() is...
      Private Shared Sub AddChooseFromLists()
            Try
                Dim oCfls As SAPbouiCOM.ChooseFromListCollection
                Dim oCons As SAPbouiCOM.Conditions
                Dim oCon As SAPbouiCOM.Condition
                Dim oCfl As SAPbouiCOM.ChooseFromList
                Dim oCflCreationParams As SAPbouiCOM.ChooseFromListCreationParams
                Dim oBtn As SAPbouiCOM.Button
                Dim oMtx As SAPbouiCOM.Matrix
                Dim oCol As SAPbouiCOM.Column
                Dim oEtx As SAPbouiCOM.EditText
                oMtx = oForm.Items.Item("MTX_TEST02").Specific
                oCfls = oForm.ChooseFromLists
                oCflCreationParams = SboCon.SboUI.CreateObject(SAPbouiCOM.BoCreatableObjectType.cot_ChooseFromListCreationParams)
                oCflCreationParams.MultiSelection = False
                oCflCreationParams.ObjectType = SAPbouiCOM.BoLinkedObject.lf_BusinessPartner
                oCflCreationParams.UniqueID = "CFL_C1"
                oCfl = oCfls.Add(oCflCreationParams)
                '### OPTION:
                '# Shown ChooseFromList restricted by Conditions
                oCons = oCfl.GetConditions()
                oCon = oCons.Add()
                oCon.Alias = "CardType"
                oCon.Operation = SAPbouiCOM.BoConditionOperation.co_EQUAL
                oCon.CondVal = "C"
                oCfl.SetConditions(oCons)
                oCol = oMtx.Columns.Item("1")
                oCol.ChooseFromListUID = "CFL_C1"
                oCol.ChooseFromListAlias = "CardCode"
            Catch e As Exception
                Microsoft.VisualBasic.MsgBox(className & ".AddChooseFromLists()" & vbCrLf & "Exception:" & vbCrLf & e.Message.ToString)
            End Try
        End Sub
    But I'm running into problems when trying to set the MTX-Cell via DataTable at the CFL-Event (see comment):
                If pVal.EventType = SAPbouiCOM.BoEventTypes.et_CHOOSE_FROM_LIST Then
                    Dim oMtx As SAPbouiCOM.Matrix
                    Dim oCFLEvent As SAPbouiCOM.IChooseFromListEvent
                    Dim oCFL As SAPbouiCOM.ChooseFromList
                    Dim oDataTable As SAPbouiCOM.DataTable
                    Dim cflID As String
                    Dim oDt As SAPbouiCOM.DataTable = oForm.DataSources.DataTables.Item("dt_test")
                    oCFLEvent = pVal
                    cflID = oCFLEvent.ChooseFromListUID
                    'Dim oForm As SAPbouiCOM.Form
                    'oForm = SboConnection.SboUI.Forms.Item(FormUID)
                    oCFL = oForm.ChooseFromLists.Item(cflID)
                    If Not oCFLEvent.BeforeAction Then
                        oDataTable = oCFLEvent.SelectedObjects
                        If oDataTable Is Nothing Then Exit Sub
                        '############## Matrix Test #######################################################################
                        If (oCFLEvent.ItemUID = "MTX_TEST02") Then
                            oMtx = oForm.Items.Item("MTX_TEST02").Specific
                            '### CFL Results to UserForm
                            oDt.Rows.Offset = oCFLEvent.Row - 1
                            MsgBox(oDt.GetValue("U_Alpha01", oCFLEvent.Row - 1))
                            MsgBox(oDataTable.GetValue("CardCode", 0))
                            ' PROBLEM - can't get this working - don't know at the moment:
                            ' on other forms SetValue works....
                            oDt.SetValue("U_Alpha01", oCFLEvent.Row - 1, oDataTable.GetValue("CardCode", 0))
                            ' this also gives me problems...:
                            'oMtx.Columns.Item("1").Cells.Item(oCFLEvent.Row).Specific.value = oDataTable.GetValue("CardCode", 0)
                            oForm.Update()
                        End If
                    End If
                End If
    The CFL-Form opens and returns the choosen value(s) at the CFL-event. But writing to MTX still not works with this code...
    Maybe you find the last piece. If so: please write here.
    Cheers,
    Roland
    p.s.:
    David Nussböck wrote
    LOL - ROLAND WAS FASTER ))
    ...just one minute...

  • Problem in matrix

    Hi every Body,
    I ve created in C# a matrix with columns, When I run the application, many rows appears but I can write only in the first row !!! I don't know why?
    I need to write on all the lines (rows) of the matrix.
    Can someone help me!

    Hello Haifa,
    The enabled is for the Matrix object, but I suggest that you use matrix.addrow() to solve the problem.
    holpe this helps,
    Pegorer.

  • Image in Matrix

    Hi All,
    Can anybody suggest me how to retrive image in Matrix column. I used following code on Matrix. I saved image in databse of specific item. Image saved in Database. In val4 i retrive that image in matrix but it is not work. Itemcode and Itemename shows in matrix properly. But image third column not shows but that image only name shows in # column.
    Can anybody tell where i am wrong to retrive the image ?
    Dim oCFLEvento As SAPbouiCOM.IChooseFromListEvent
                oCFLEvento = pVal
                Dim sCFL_ID As String
                sCFL_ID = oCFLEvento.ChooseFromListUID
                Dim oCFL As SAPbouiCOM.ChooseFromList
                oCFL = form.ChooseFromLists.Item(sCFL_ID)
                If oCFLEvento.BeforeAction = False Then
                    Dim oDataTable As SAPbouiCOM.DataTable
                    oDataTable = oCFLEvento.SelectedObjects
                    Dim val2 As String
                    Dim val3 As String
                    Dim val4 As String
                    Dim DB1 As SAPbouiCOM.DataTable
                    val2 = oDataTable.GetValue(0, 0)
                    val3 = oDataTable.GetValue(1, 0)
                    val4 = oDataTable.GetValue(43, 0)
                    Dim CurrentRow As Integer = pVal.Row
                    DB1 = form.DataSources.DataTables.Item("DT_1")
                    If CurrentRow = matrix.RowCount Then
                        DB1.Rows.Add()
                        matrix.AddRow()
                        DB1.SetValue("Col_0", CurrentRow - 1, val2)
                        DB1.SetValue("Col_1", CurrentRow - 1, val3)
                        DB1.SetValue("Col_2", CurrentRow - 1, val4)
                        matrix.SetLineData(CurrentRow)
                    Else
                        DB1.SetValue("Col_0", CurrentRow - 1, val2)
                        DB1.SetValue("Col_1", CurrentRow - 1, val3)
                        DB1.SetValue("Col_2", CurrentRow - 1, val4)
                        matrix.LoadFromDataSource()
                    End If
                    matrix.FlushToDataSource()
                  End If

    Hi Harish,
    When adding the column to the matrix that will hold this image, have you set the column type to Picture?
    Set oColumn = oColumns.Add("F", it_PICTURE)
    You can find the enumeration for all column types in the SDK help file under the Add method of the columns collection.
    Hope this is useful to you,
    Regards,
    Niall
    SAP Business One Forums Team

  • Problem using Matrix

    I am doing very simple work with matrix.
    In screen painter I have added one matrix control.
    There was one column by default.
    Then I set alias =<col name>
    databound =true
    table=<table name>
    for the column
    and run the form using screen painter.
    but the matrix is not editable in add mode.
    What is the problem.
    pls. rply me

    you will have to explicitly add the row to make this editable.
    matrix.AddRow(1);

  • Dbdatasource bound matrix and form.freeze bug

    I have a UDO, with a child talbe attached to it correctly.
    I've build a form to handle the UDO and it's child, in a bound matrix, and everything works fine.
    There are 2 comboboxes in the matrix. I want to update a combobox upon selecting in the other combobox. it works fine, yet it looks 'silly' since you can see the focus going to the other cobobox and then return to the original combobox. I thought the Form.Freeze would help me, but it doesnt.
    It seems that a dbdatasource-bound-matrix will not show it changes made while being in From.Freeze(True) state. And although changes are not show, they are made, meaning you can click the other combobox and see that the selected value is the one you programmatically selected, but the value inside the box remains as it was before evoking From.Freeze(True).

    Hi Avi,
    I have created a UDForm for a UDO (Document) with a Matrix for the child table.  I am able to Add the Header with the Child Lines into the DB.  My Problem is that when I need to Update the Document, i call it up, and all the data is shown.  I call "Matrix.AddRow()" and it DUPLICATES the Last line from the matrix into the new row.  So I delete the Duplicated Item Code and retype the new added Item Code and relevent columns.  When I click on "UPDATE" the system says that....
    "This Entry Already Exists in the Following Tables " @EB.........
    I've been searching the forum for posible answers and I cam across your posting saying that you were successfull in achieving what I am battling with.
    Could you please help me with this issue.
    I've posted a new Thread as follows.....
    [New Row in Matrix is a Duplicate and Cannot update Object with new Row;

  • Child value is not updated?

    Private Sub SBO_Application_ItemEvent(ByVal FormUID As String, ByRef pVal As SAPbouiCOM.ItemEvent, ByRef BubbleEvent As Boolean) Handles SBO_Application.ItemEvent
            Dim i As Integer
            Dim sumdepth As Decimal = 0
            Dim oForm As SAPbouiCOM.Form
            Dim Matrix As SAPbouiCOM.Matrix
            oForm = SBO_Application.Forms.Item(FormUID)
            Select Case pVal.EventType
                Case SAPbouiCOM.BoEventTypes.et_ITEM_PRESSED
                    '// Check if the event was raised by one of the Folder items
                    '// and change the form's pane level
                Case SAPbouiCOM.BoEventTypes.et_CLICK
                    If pVal.ItemUID = "1" And pVal.BeforeAction = True Then
                        If oForm.Mode = SAPbouiCOM.BoFormMode.fm_ADD_MODE Or oForm.Mode = SAPbouiCOM.BoFormMode.fm_UPDATE_MODE Then
                            'If Validation() = False Then
                            If oForm.Items.Item("OrdrVal").Specific().Value = "" Then
                                BubbleEvent = False
                                'SBO_Application.MessageBox(" Please Enter  The Order No ")
                                SBO_Application.StatusBar.SetText("Enter The  Order  No- 3029 Item Is Not Selectable  ", SAPbouiCOM.BoMessageTime.bmt_Long, SAPbouiCOM.BoStatusBarMessageType.smt_Error)
                                oForm.Items.Item("OrdrVal").Click(SAPbouiCOM.BoCellClickType.ct_Regular)
                                Exit Sub
                            End If
                            If oForm.Items.Item("LocVal").Specific().Value = "" Then
                                BubbleEvent = False
                                ' SBO_Application.MessageBox(" Please Enter  The Location ")
                                SBO_Application.StatusBar.SetText("Enter The  Location - 3029 Item Is Not Selectable  ", SAPbouiCOM.BoMessageTime.bmt_Long, SAPbouiCOM.BoStatusBarMessageType.smt_Error)
                                oForm.Items.Item("LocVal").Click(SAPbouiCOM.BoCellClickType.ct_Regular)
                                Exit Sub
                            End If
                            If oForm.Items.Item("SupVal").Specific().Value = "" Then
                                BubbleEvent = False
                                ' SBO_Application.MessageBox(" Please Enter  The Location ")
                                SBO_Application.StatusBar.SetText("Enter The  Supervisor - 3029 Item Is Not Selectable  ", SAPbouiCOM.BoMessageTime.bmt_Long, SAPbouiCOM.BoStatusBarMessageType.smt_Error)
                                oForm.Items.Item("SupVal").Click(SAPbouiCOM.BoCellClickType.ct_Regular)
                                Exit Sub
                            End If
                            Matrix = oForm.Items.Item("Matrix1").Specific
                            If Matrix.Columns.Item("Depth").Cells.Item(1).Specific.Value = "" Then
                                BubbleEvent = False
                                ' SBO_Application.MessageBox(" Please Enter  The Location ")
                                SBO_Application.StatusBar.SetText("Enter The  Depth - 3029 Item Is Not Selectable  ", SAPbouiCOM.BoMessageTime.bmt_Long, SAPbouiCOM.BoStatusBarMessageType.smt_Error)
                                ' oForm.Items.Item("Depth").Click(SAPbouiCOM.BoCellClickType.ct_Regular)
                                Exit Sub
                            End If
                            'Dim sSQL As String
                            'Dim logno As Integer
                            ''sSQL = "SELECT COUNT(DocEntry)AS count FROM [@OOBR]"
                            'sSQL = "SELECT Max(DocEntry)AS count FROM [@OOBR]"
                            'oLineRec = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)
                            'oLineRec.DoQuery(sSQL)
                            'logno = CInt(oLineRec.Fields.Item(0).Value) + 1
                            'oForm.Items.Item("LogVal").Specific().Value = logno
                        End If
                    End If
            End Select
            If pVal.EventType = SAPbouiCOM.BoEventTypes.et_CHOOSE_FROM_LIST Then
                Dim oCFLEvento As SAPbouiCOM.IChooseFromListEvent
                oCFLEvento = pVal
                Dim sCFL_ID As String
                sCFL_ID = oCFLEvento.ChooseFromListUID
                Dim oCFL As SAPbouiCOM.ChooseFromList
                oCFL = oForm.ChooseFromLists.Item(sCFL_ID)
                'SBO_Application.MessageBox(oCFL)
                If oCFLEvento.BeforeAction = False Then
                    Dim oDataTable As SAPbouiCOM.DataTable
                    oDataTable = oCFLEvento.SelectedObjects
                    ShowValue(pVal, oDataTable, oForm)
                End If
            End If
            Matrix = oForm.Items.Item("Matrix1").Specific
            If ((pVal.ItemUID = "Matrix1") And (pVal.Row = Matrix.RowCount) And (pVal.EventType = SAPbouiCOM.BoEventTypes.et_KEY_DOWN)) Then
                Matrix.AddRow(1, -1)
                Matrix.Columns.Item("#").Cells.Item(Matrix.RowCount).Specific.Value = Matrix.RowCount
            End If
            If ((pVal.FormUID = "SM_OBRFM") And (pVal.EventType = SAPbouiCOM.BoEventTypes.et_ITEM_PRESSED) Or (pVal.EventType = SAPbouiCOM.BoEventTypes.et_KEY_DOWN)) Then
                For i = 1 To Matrix.RowCount
                    sumdepth += Matrix.Columns.Item("Depth").Cells.Item(i).Specific.Value
                    oForm.Items.Item("DepthVal").Specific().value = sumdepth
                    Dim oDocRec As SAPbobsCOM.Recordset
                    Dim sSQL As String
                    If oDocRec.RecordCount > 0 Then
                        sSQL = ""
                        Dim UpdateRec As SAPbobsCOM.Recordset
                        UpdateRec = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)
                        UpdateRec.DoQuery(sSQL)
                    End If
                Next
            End If
            If (FormUID = "SM_OBRFM") And (pVal.EventType = SAPbouiCOM.BoEventTypes.et_FORM_UNLOAD) Then
                Windows.Forms.Application.Exit()
            End If
        End Sub
        Private Sub SalesOrdrCFL(ByVal oForm As SAPbouiCOM.Form)
            Try
                Dim oCFLs As SAPbouiCOM.ChooseFromListCollection
                'Dim oCons As SAPbouiCOM.Conditions
                'Dim oCon As SAPbouiCOM.Condition
                oCFLs = oForm.ChooseFromLists
                Dim oCFL As SAPbouiCOM.ChooseFromList
                Dim oCFLCreationParams As SAPbouiCOM.ChooseFromListCreationParams
                oCFLCreationParams = SBO_Application.CreateObject(SAPbouiCOM.BoCreatableObjectType.cot_ChooseFromListCreationParams)
                ' Adding 2 CFL, one for the button and one for the edit text.
                oCFLCreationParams.MultiSelection = False
                oCFLCreationParams.ObjectType = "17"
                oCFLCreationParams.UniqueID = "CFL1"
                oCFL = oCFLs.Add(oCFLCreationParams)
                oCFLCreationParams.UniqueID = "CFL2"
                oCFL = oCFLs.Add(oCFLCreationParams)
            Catch
                MsgBox(Err.Description)
            End Try
        End Sub
    error   data already exist in child table

    Imports System
    Imports System.web
    Imports System.Windows.Forms.Form
    Public Class SM_DPSFM
        '// At the begining of every UI API project we should first
        '// establish connection with a running SBO application.
        Private WithEvents SBO_Application As SAPbouiCOM.Application
        Private oForm As SAPbouiCOM.Form
        Dim oButton As SAPbouiCOM.Button
        Dim oOptionBtn As SAPbouiCOM.OptionBtn
        Dim oCheckBox As SAPbouiCOM.CheckBox
        Dim oComboBox As SAPbouiCOM.ComboBox
        Dim oItem As SAPbouiCOM.Item
        Dim oStatic As SAPbouiCOM.StaticText
        Dim oEdittext As SAPbouiCOM.EditText
        Dim oEditItem As SAPbouiCOM.EditText
        Private oMatrix As SAPbouiCOM.Matrix
        Private Matrix2 As SAPbouiCOM.Matrix
        Private oLink As SAPbouiCOM.LinkedButton
        Private oColumns As SAPbouiCOM.Columns
        Private oColumn As SAPbouiCOM.Column
        Private sPath As String
        Private oDBDataSource As SAPbouiCOM.DBDataSource
        Private oCompany As SAPbobsCOM.Company
        Private rs As SAPbobsCOM.Recordset
        Private oLineRec As SAPbobsCOM.Recordset
        Private rs1 As SAPbobsCOM.Recordset
        '// declaring a User data source for the "Remarks" Column
        Private oUserDataSource As SAPbouiCOM.UserDataSource
        Public sErrMsg As String
        Public lErrCode As Long
        Public lRetCode As Long
        Private Sub SetApplication()
            '// Use an SboGuiApi object to establish the connection
            '// with the application and return an initialized appliction object
            Dim SboGuiApi As SAPbouiCOM.SboGuiApi
            Dim sConnectionString As String
            SboGuiApi = New SAPbouiCOM.SboGuiApi
            '// by following the steps specified above, the following
            '// statment should be suficient for either development or run mode
            sConnectionString = Environment.GetCommandLineArgs.GetValue(1)
            '// connect to a running SBO Application
            SboGuiApi.Connect(sConnectionString)
            '// get an initialized application object
            SBO_Application = SboGuiApi.GetApplication()
        End Sub
        Private Sub AddMenuItems()
            '// Let's add a pop-up menu item and 2 sub menu items
            Dim oMenus As SAPbouiCOM.Menus               '//  use the following object to add menu
            Dim oMenuItem As SAPbouiCOM.MenuItem
            '// Get the menus collection from the application
            oMenus = SBO_Application.Menus
            Dim oCreationPackage As SAPbouiCOM.MenuCreationParams
            oCreationPackage = SBO_Application.CreateObject(SAPbouiCOM.BoCreatableObjectType.cot_MenuCreationParams)
            oMenuItem = SBO_Application.Menus.Item("43520") 'moudles'
            sPath = System.Windows.Forms.Application.StartupPath()
            sPath = sPath.Remove(sPath.Length - 3, 3)
            '' Creation parameters
            oCreationPackage.Type = SAPbouiCOM.BoMenuType.mt_POPUP
            oCreationPackage.UniqueID = "SM_DMID"
            oCreationPackage.String = "Dealer Mgmt."
            'oCreationPackage.Image = sPath & "dealermg.gif"
            oCreationPackage.Image = IO.Directory.GetParent(Application.StartupPath).ToString & "\CFL.BMP"
            '' we add our menu at the buttom of the list
            oCreationPackage.Position = oMenuItem.SubMenus.Count + 1
            oMenus = oMenuItem.SubMenus
            Try ' If the menu already exists this code will fail
                oMenus.AddEx(oCreationPackage)
                '' Get the menu collection of the newly added pop-up item
                oMenuItem = SBO_Application.Menus.Item("SM_DMID")
                oMenus = oMenuItem.SubMenus
                '' Add Sub Menu Items
                oCreationPackage.Type = SAPbouiCOM.BoMenuType.mt_STRING
                oCreationPackage.UniqueID = "SM_DPSMENU"         ''Unique ID of 1st Sub Menu item
                oCreationPackage.String = "Dumper Performance Sheet"
                oMenus.AddEx(oCreationPackage)
            Catch er As Exception ' Error Handling
                SBO_Application.MessageBox(er.Message)
            End Try
        End Sub
        'Private Sub AddMenuItems()
        '    '// Let's add a pop-up menu item and 2 sub menu items
        '    Dim oMenus As SAPbouiCOM.Menus               '//  use the following object to add menu
        '    Dim oMenuItem As SAPbouiCOM.MenuItem
        '    '// Get the menus collection from the application
        '    oMenus = SBO_Application.Menus
        '    Dim oCreationPackage As SAPbouiCOM.MenuCreationParams
        '    oMenuItem = SBO_Application.Menus.Item("SM_DMID")
        '    sPath = System.Windows.Forms.Application.StartupPath()
        '    sPath = sPath.Remove(sPath.Length - 3, 3)
        '    oMenus = oMenuItem.SubMenus
        '    Try ' If the menu already exists this code will fail
        '        '' Add Sub Menu Items
        '        oCreationPackage = SBO_Application.CreateObject(SAPbouiCOM.BoCreatableObjectType.cot_MenuCreationParams)
        '        oCreationPackage.UniqueID = "SM_DPSMENU"
        '        oCreationPackage.String = "Dumper Performance Sheet"
        '        oCreationPackage.Position = 1
        '        oCreationPackage.Type = SAPbouiCOM.BoMenuType.mt_STRING
        '        oMenuItem = oMenus.AddEx(oCreationPackage)
        '    Catch er As Exception ' Error Handling
        '        SBO_Application.MessageBox(er.Message)
        '    End Try
        'End Sub
        Private Sub SBO_Application_MenuEvent(ByRef pVal As SAPbouiCOM.MenuEvent, ByRef BubbleEvent As Boolean) Handles SBO_Application.MenuEvent
            If pVal.BeforeAction = False Then
                Select Case pVal.MenuUID
                    Case "SM_DPSMENU"
                        diplay_DPSform() ''Function to display 1st Sub Menu item (D.P.S.) form.
                End Select
            End If
        End Sub
        'Function to draw the Dumper Performance Sheet.
        Private Sub diplay_DPSform()
            Dim oForm As SAPbouiCOM.Form
            Dim val1 As String
            Try
                oForm = SBO_Application.Forms.Item("SM_DPSFM")
                SBO_Application.MessageBox("Form Already Open")
            Catch ex As Exception
                Dim fcp As SAPbouiCOM.FormCreationParams
                fcp = SBO_Application.CreateObject(SAPbouiCOM.BoCreatableObjectType.cot_FormCreationParams)
                fcp.BorderStyle = SAPbouiCOM.BoFormBorderStyle.fbs_Fixed
                fcp.FormType = "SM_DPSFM"
                fcp.ObjectType = "SM_DPS"
                fcp.UniqueID = "SM_DPSFM"
                fcp.BorderStyle = SAPbouiCOM.BoFormBorderStyle.fbs_Sizable
                oForm = SBO_Application.Forms.AddEx(fcp)
                oForm.AutoManaged = False
                SalesOrdrCFL(oForm)             ''Function to see the list of Sales Orders.
                'OBRCFL(oForm)
                itemlist(oForm)
                DrawDPSForm(oForm)
                ''Function to Draw the form for 1st Sub Menu
            End Try
            oForm.DataBrowser.BrowseBy = "DpsVal"
            oForm.Visible = True
        End Sub
        ''Function to Draw the form for Sub Menu
        Private Sub DrawDPSForm(ByVal oForm As SAPbouiCOM.Form)
            Dim oItem As SAPbouiCOM.Item
            Dim oButton As SAPbouiCOM.Button
            Dim oEdittext As SAPbouiCOM.EditText
            Dim val As String
            ''Form specifications
            oForm.Title = "Dumper Performance Sheet"
            oForm.Left = 320 '340
            oForm.ClientWidth = 550 '350
            oForm.Top = 100
            oForm.ClientHeight = 422 '393
            'Adding a datasource to the form
            oDBDataSource = oForm.DataSources.DBDataSources.Add("@ODPS")
            ''Order Text
            oItem = oForm.Items.Add("OrdrTxt", SAPbouiCOM.BoFormItemTypes.it_STATIC)
            oItem.Left = 5
            oItem.Width = 100
            oItem.Top = 10
            ' oItem.AffectsFormMode = False
            oItem.LinkTo = "OrdrVal"
            oStatic = oItem.Specific
            oStatic.Caption = "Order No."
            ''Order Date Text
            oItem = oForm.Items.Add("OrdrdtTxt", SAPbouiCOM.BoFormItemTypes.it_STATIC)
            oItem.Left = 5
            oItem.Width = 100
            oItem.Top = 27
            oItem.AffectsFormMode = False
            oItem.LinkTo = "OrdrdtVal"
            oStatic = oItem.Specific
            oStatic.Caption = "Order Date"
            ''Customer Text Box
            oItem = oForm.Items.Add("CustTxt", SAPbouiCOM.BoFormItemTypes.it_STATIC)
            oItem.Left = 5
            oItem.Width = 100
            oItem.Top = 44
            oItem.AffectsFormMode = False
            oItem.LinkTo = "CustVal"
            oStatic = oItem.Specific
            oStatic.Caption = "Customer Name"
            ''DPS Text
            oItem = oForm.Items.Add("DpsTxt", SAPbouiCOM.BoFormItemTypes.it_STATIC)
            oItem.Left = 290 '271
            oItem.Width = 50  '100
            oItem.Top = 10
            oItem.AffectsFormMode = False
            oItem.LinkTo = "DpsVal"
            oStatic = oItem.Specific
            oStatic.Caption = "DPS No."
            ''DPS Date
            oItem = oForm.Items.Add("DateTxt", SAPbouiCOM.BoFormItemTypes.it_STATIC)
            oItem.Left = 290
            oItem.Width = 50 '100
            oItem.Top = 27
            oItem.AffectsFormMode = False
            oItem.LinkTo = "DateVal"
            oStatic = oItem.Specific
            oStatic.Caption = "DPS Date"
            ''Log No. Text
            oItem = oForm.Items.Add("LogTxt", SAPbouiCOM.BoFormItemTypes.it_STATIC)
            oItem.Left = 5 '290
            oItem.Width = 100 '50 '100
            oItem.Top = 61
            oItem.AffectsFormMode = False
            oItem.LinkTo = "LogVal"
            oStatic = oItem.Specific
            oStatic.Caption = "Log No."
            ''SuperVisor Text
            oItem = oForm.Items.Add("SupTxt", SAPbouiCOM.BoFormItemTypes.it_STATIC)
            oItem.Left = 5
            oItem.Width = 100
            oItem.Top = 300
            oItem.AffectsFormMode = False
            oItem.LinkTo = "SupVal"
            oStatic = oItem.Specific
            oStatic.Caption = "Supervisor"
            ''Total Trip for S/M Text
            oItem = oForm.Items.Add("Trip1Txt", SAPbouiCOM.BoFormItemTypes.it_STATIC)
            oItem.Left = 290
            oItem.Width = 140 '100
            oItem.Top = 300
            oItem.AffectsFormMode = False
            oItem.LinkTo = "Trip1Val"
            oStatic = oItem.Specific
            oStatic.Caption = "Total Trips Made For S/M"
            ''Remarks Text
            oItem = oForm.Items.Add("RmksTxt", SAPbouiCOM.BoFormItemTypes.it_STATIC)
            oItem.Left = 5
            oItem.Width = 50 '100
            oItem.Top = 320
            oItem.AffectsFormMode = False
            oItem.LinkTo = "RmksVal"
            oStatic = oItem.Specific
            oStatic.Caption = "Remarks"
            ''Total Trip for LATERITE Text
            oItem = oForm.Items.Add("Trip2Txt", SAPbouiCOM.BoFormItemTypes.it_STATIC)
            oItem.Left = 290
            oItem.Width = 140 '100
            oItem.Top = 320
            oItem.AffectsFormMode = False
            oItem.LinkTo = "Trip2Val"
            oStatic = oItem.Specific
            oStatic.Caption = "Total Trips Made For LAT"
            ''Total Trip for BAUXITE Text
            oItem = oForm.Items.Add("Trip3Txt", SAPbouiCOM.BoFormItemTypes.it_STATIC)
            oItem.Left = 290
            oItem.Width = 140 '100
            oItem.Top = 340
            oItem.AffectsFormMode = False
            oItem.LinkTo = "Trip3Val"
            oStatic = oItem.Specific
            oStatic.Caption = "Total Trips Made For BAUX "
            ''Total Trip for Item4 Text
            oItem = oForm.Items.Add("Trip4Txt", SAPbouiCOM.BoFormItemTypes.it_STATIC)
            oItem.Left = 290
            oItem.Width = 140 '100
            oItem.Top = 360
            oItem.AffectsFormMode = False
            oItem.LinkTo = "Trip4Val"
            oStatic = oItem.Specific
            oStatic.Caption = "Total Trips Made For Itm4"
            ''Total Trip for Item5 Text
            oItem = oForm.Items.Add("Trip5Txt", SAPbouiCOM.BoFormItemTypes.it_STATIC)
            oItem.Left = 290
            oItem.Width = 140 '100
            oItem.Top = 380
            oItem.AffectsFormMode = False
            oItem.LinkTo = "Trip5Val"
            oStatic = oItem.Specific
            oStatic.Caption = "Total Trips Made For Itm5"
            'oItem = oForm.Items.Add("Txt", SAPbouiCOM.BoFormItemTypes.it_STATIC)
            'oItem.Left = 106
            'oItem.Width = 4
            'oItem.Top = 10
            '' oItem.AffectsFormMode = False
            ''oItem.LinkTo = "OrdrVal" '"Vndval"
            'oStatic = oItem.Specific
            ''oStatic.Caption = "Order No."
            'oLink = oItem.ExtendedObject '// new property
            'oLink.LinkedObject = SAPbouiCOM.BoLinkedObject.lf_Order
            Dim oEditlogdt As SAPbouiCOM.EditText
            ' Dim oEdittype As SAPbouiCOM.EditText
            'Dim oEditloc As SAPbouiCOM.EditText
            Dim oEditordr As SAPbouiCOM.EditText
            Dim oEditorddt As SAPbouiCOM.EditText
            Dim oEditcust As SAPbouiCOM.EditText
            Dim oEditdep As SAPbouiCOM.EditText
            Dim oEditsup As SAPbouiCOM.EditText
            Dim oEditrmrk As SAPbouiCOM.EditText
            Dim val1 As String
            Dim sSQL As String
            Dim logno As Integer
            sSQL = "SELECT Max(DocEntry)AS count FROM [@ODPS]"
            oLineRec = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)
            oLineRec.DoQuery(sSQL)
            logno = CInt(oLineRec.Fields.Item(0).Value) + 1
            ''DPS No. Edit Box
            oItem = oForm.Items.Add("DpsVal", SAPbouiCOM.BoFormItemTypes.it_EDIT)
            oItem.Left = 376
            oItem.Width = 160
            oItem.Top = 10
            oItem.AffectsFormMode = True
            oItem.LinkTo = "DpsTxt"
            oItem.Enabled = False
            oEdittext = oItem.Specific
            oEdittext.DataBind.SetBound(True, "@ODPS", "DocEntry")
            oEdittext.Value = logno
            ''Order Edit Text Box
            oItem = oForm.Items.Add("OrdrVal", SAPbouiCOM.BoFormItemTypes.it_EDIT)
            oItem.Left = 110
            oItem.Width = 160
            oItem.Top = 10
            oItem.LinkTo = "OrdrTxt"
            oItem.AffectsFormMode = True
            oEditordr = oItem.Specific
            '' Adding Choose From List
            oEditordr.DataBind.SetBound(True, "@ODPS", "U_ordrno")
            ' Adding 2 Choose From List Object, ONE FOR EDIT TEXT AND ONE FOR BUTTON.
            oEditordr.ChooseFromListUID = "CFL1"
            ''We set the alias only after the UID is set, the alias is the field in the database
            ''It compares the value in the edit text and narrows the CFL accrodingly
            oEditordr.ChooseFromListAlias = "DocEntry" '"CardCode"
            ''Order Date Edit Box
            oItem = oForm.Items.Add("OrdrdtVal", SAPbouiCOM.BoFormItemTypes.it_EDIT)
            oItem.Left = 110
            oItem.Width = 160
            oItem.Top = 27
            oItem.AffectsFormMode = True
            oItem.LinkTo = "OrdrdtTxt"
            oItem.Enabled = False
            oEditorddt = oItem.Specific
            oEditorddt.DataBind.SetBound(True, "@ODPS", "U_ordrdt")
            ' oEditorddt.String = Format(DateTime.Today, "ddMMyy")
            ''Customer Edit Box
            oItem = oForm.Items.Add("CustVal", SAPbouiCOM.BoFormItemTypes.it_EDIT)
            oItem.Left = 110
            oItem.Width = 160
            oItem.Top = 44
            oItem.AffectsFormMode = True
            oItem.LinkTo = "CustTxt"
            oItem.Enabled = False
            oEditcust = oItem.Specific
            oEditcust.DataBind.SetBound(True, "@ODPS", "U_customer")
            ''DPS Date Edit Box
            oItem = oForm.Items.Add("DateVal", SAPbouiCOM.BoFormItemTypes.it_EDIT)
            oItem.Left = 376
            oItem.Width = 160
            oItem.Top = 27
            oItem.AffectsFormMode = True
            oItem.LinkTo = "DateTxt"
            oEditlogdt = oItem.Specific
            oEditlogdt.DataBind.SetBound(True, "@ODPS", "U_dpsdt")
            oEditlogdt.String = Format(DateTime.Today, "ddMMyy")
            ''Log No. Edit
            oItem = oForm.Items.Add("LogVal", SAPbouiCOM.BoFormItemTypes.it_COMBO_BOX)
            oItem.Left = 110
            oItem.Width = 160
            oItem.Top = 61
            oItem.AffectsFormMode = True
            oItem.LinkTo = "LogTxt"
            oComboBox = oItem.Specific
            AddLogCodeCombo(oForm, val1)
            'AddLogCodeCombo(oComboBox)
            oComboBox.DataBind.SetBound(True, "@ODPS", "U_logno")
            'oComboBox.ValidValues.Add("", "")
            'oComboBox.Select(0, SAPbouiCOM.BoSearchKey.psk_Index)
            ''Total Trip for S/M Edit Box
            oItem = oForm.Items.Add("Trip1Val", SAPbouiCOM.BoFormItemTypes.it_EDIT)
            oItem.Left = 430 '376
            oItem.Width = 105 '80
            oItem.Top = 300
            oItem.AffectsFormMode = True
            oItem.LinkTo = "Trip1Txt"
            oItem.Enabled = False
            oEditdep = oItem.Specific
            oEditdep.DataBind.SetBound(True, "@ODPS", "U_ttaltripsm")
            ''SuperVisor Edit Box
            oItem = oForm.Items.Add("SupVal", SAPbouiCOM.BoFormItemTypes.it_EDIT)
            oItem.Left = 110
            oItem.Width = 160
            oItem.Top = 300
            oItem.AffectsFormMode = True
            oItem.LinkTo = "SupTxt"
            oEditsup = oItem.Specific
            oEditsup.DataBind.SetBound(True, "@ODPS", "U_suprvsr")
            ''Remarks Edit Box
            oItem = oForm.Items.Add("RmksVal", SAPbouiCOM.BoFormItemTypes.it_EXTEDIT)
            oItem.Left = 110
            oItem.Width = 160
            oItem.Top = 320
            oItem.AffectsFormMode = True
            oItem.LinkTo = "RmksTxt"
            oEditrmrk = oItem.Specific
            oEditrmrk.DataBind.SetBound(True, "@ODPS", "U_remark")
            ''Total Trip for Laterite Edit Box
            oItem = oForm.Items.Add("Trip2Val", SAPbouiCOM.BoFormItemTypes.it_EDIT)
            oItem.Left = 430 '376
            oItem.Width = 105 '80
            oItem.Top = 320
            oItem.AffectsFormMode = True
            oItem.LinkTo = "Trip2Txt"
            oItem.Enabled = False
            oEditdep = oItem.Specific
            oEditdep.DataBind.SetBound(True, "@ODPS", "U_ttaltriplat")
            ''Total Trip for Bauxite Edit Box
            oItem = oForm.Items.Add("Trip3Val", SAPbouiCOM.BoFormItemTypes.it_EDIT)
            oItem.Left = 430 '376
            oItem.Width = 105 '80
            oItem.Top = 340
            oItem.AffectsFormMode = True
            oItem.LinkTo = "Trip3Txt"
            oItem.Enabled = False
            oEditdep = oItem.Specific
            oEditdep.DataBind.SetBound(True, "@ODPS", "U_ttaltripbx")
            ''Total Trip for Item4 Edit Box
            oItem = oForm.Items.Add("Trip4Val", SAPbouiCOM.BoFormItemTypes.it_EDIT)
            oItem.Left = 430 '376
            oItem.Width = 105 '80
            oItem.Top = 360
            oItem.AffectsFormMode = True
            oItem.LinkTo = "Trip4Txt"
            oItem.Enabled = False
            oEditdep = oItem.Specific
            oEditdep.DataBind.SetBound(True, "@ODPS", "U_ttaltripitm4")
            ''Total Trip for Item 5 Edit Box
            oItem = oForm.Items.Add("Trip5Val", SAPbouiCOM.BoFormItemTypes.it_EDIT)
            oItem.Left = 430 '376
            oItem.Width = 105 '160
            oItem.Top = 380
            oItem.AffectsFormMode = True
            oItem.LinkTo = "Trip5Txt"
            oItem.Enabled = False
            oEditdep = oItem.Specific
            oEditdep.DataBind.SetBound(True, "@ODPS", "U_ttaltripitm5")
            '// Adding a OrderCFL button
            oItem = oForm.Items.Add("Button1", SAPbouiCOM.BoFormItemTypes.it_BUTTON)
            oItem.Left = 269 '271
            oItem.Top = 8
            oButton = oItem.Specific
            oButton.Type = SAPbouiCOM.BoButtonTypes.bt_Image
            oItem.Width = 20
            oItem.Height = 20
            oButton.Image = IO.Directory.GetParent(Application.StartupPath).ToString & "\CFL.BMP"
            'SBO_Application.MessageBox(oButton.Image)
            'oButton.Image = "C:\Documents and Settings\subratac\My Documents\Visual Studio 2005\Projects\TestAddonApplication\TestAddonApplication\bin\CFL.BMP"
            '' Adding Choose From List Object FOR  BUTTON.
            oButton.ChooseFromListUID = "CFL2"
            'Adding a datasource to the form
            oDBDataSource = oForm.DataSources.DBDataSources.Add("@DPS1")
            '// Adding a Matrix item
            oItem = oForm.Items.Add("Matrix1", SAPbouiCOM.BoFormItemTypes.it_MATRIX)
            oItem.Left = 5
            oItem.Width = 550 '350
            oItem.Top = 95
            oItem.Height = 200 '150
            oMatrix = oItem.Specific
            oColumns = oMatrix.Columns
            '// Adding Culomn items to the matrix
            oColumn = oColumns.Add("#", SAPbouiCOM.BoFormItemTypes.it_EDIT)
            oColumn.TitleObject.Caption = "#"
            oColumn.Width = 50
            oColumn.Editable = False
            'oColumn.DataBind.SetBound(True, "@DPS1", "U_holeno")
            '// Add a column for Vehicle no.
            'oColumn = oColumns.Add("Vhcleno", SAPbouiCOM.BoFormItemTypes.it_EDIT)
            'oColumn.TitleObject.Caption = "Vehicle No."
            'oColumn.Width = 80
            'oColumn.Editable = True
            oColumn = oColumns.Add("Vhcleno", SAPbouiCOM.BoFormItemTypes.it_LINKED_BUTTON)
            oColumn.TitleObject.Caption = "Vehicle No."
            oColumn.Width = 80
            oColumn.Editable = True
            oLink = oColumn.ExtendedObject
            oLink.LinkedObject = SAPbouiCOM.BoLinkedObject.lf_Items
            oColumn.DataBind.SetBound(True, "@DPS1", "U_vehcleno")
            oColumn.ChooseFromListUID = "CFL5"
            oColumn.ChooseFromListAlias = "ItemCode"
            '// Add a column for vehicle name
            oColumn = oColumns.Add("Vhclenm", SAPbouiCOM.BoFormItemTypes.it_EDIT)
            oColumn.TitleObject.Caption = "Vehicle Name"
            oColumn.Width = 80
            oColumn.Editable = True
            oColumn.DataBind.SetBound(True, "@DPS1", "U_vehclenm")
            '// Add a column for Trip S/M
            oColumn = oColumns.Add("Trpsm", SAPbouiCOM.BoFormItemTypes.it_EDIT)
            oColumn.TitleObject.Caption = "Trip(S/M)"
            oColumn.Width = 80
            oColumn.Editable = True
            oColumn.DataBind.SetBound(True, "@DPS1", "U_tripsm")
            '// Add a column for Trip Laterite
            oColumn = oColumns.Add("Trplat", SAPbouiCOM.BoFormItemTypes.it_EDIT)
            oColumn.TitleObject.Caption = "Trip(Laterite)"
            oColumn.Width = 80
            oColumn.Editable = True
            oColumn.DataBind.SetBound(True, "@DPS1", "U_triplat")
            '// Add a column for Trip Bauxite
            oColumn = oColumns.Add("Trpbax", SAPbouiCOM.BoFormItemTypes.it_EDIT)
            oColumn.TitleObject.Caption = "Trip(Bauxite)"
            oColumn.Width = 80
            oColumn.Editable = True
            oColumn.DataBind.SetBound(True, "@DPS1", "U_tripbx")
            '// Add a column for Item 4
            oColumn = oColumns.Add("Trpitm4", SAPbouiCOM.BoFormItemTypes.it_EDIT)
            oColumn.TitleObject.Caption = "Trip(Item 4)"
            oColumn.Width = 80
            oColumn.Editable = True
            oColumn.DataBind.SetBound(True, "@DPS1", "U_tripitm4")
            '// Add a column for Item 5
            oColumn = oColumns.Add("Trpitm5", SAPbouiCOM.BoFormItemTypes.it_EDIT)
            oColumn.TitleObject.Caption = "Trip(Item 5)"
            oColumn.Width = 80
            oColumn.Editable = True
            oColumn.DataBind.SetBound(True, "@DPS1", "U_tripitm5")
            ''// Link the column to the Stock Transfer master data system form
            'oLink = oColumn.ExtendedObject
            'oLink.LinkedObject = SAPbouiCOM.BoLinkedObject.lf_StockTransfers
            '// Adding a OK button
            oItem = oForm.Items.Add("1", SAPbouiCOM.BoFormItemTypes.it_BUTTON)
            oItem.Left = 5
            oItem.Width = 65
            oItem.Top = 400 '372
            oItem.Height = 20
            oButton = oItem.Specific
            '// Adding a Cancel button
            oItem = oForm.Items.Add("2", SAPbouiCOM.BoFormItemTypes.it_BUTTON)
            oItem.Left = 75
            oItem.Width = 65
            oItem.Top = 400 '372
            oItem.Height = 20
            oButton = oItem.Specific
            AddLogCodeCombo(oForm, val)
            oForm.DataBrowser.BrowseBy = "DpsVal"
        End Sub
        Public Sub New()
            MyBase.New()
            Try
                SetApplication()
                ' Set The Connection Context
                If Not SetConnectionContext() = 0 Then
                    SBO_Application.MessageBox("Failed setting a connection to DI API")
                    End ' Terminating the Add-On Application
                End If
                If Not ConnectToCompany() = 0 Then
                    SBO_Application.MessageBox("Failed connecting to the company's Data Base")
                    End ' Terminating the Add-On Application
                End If
                'SBO_Application.MessageBox("DI Connected To: " & oCompany.CompanyName)
            Catch
                System.Windows.Forms.MessageBox.Show("SBO application not found")
            End Try
            AddMenuItems()
        End Sub
        Private Sub SBO_Application_AppEvent(ByVal EventType As SAPbouiCOM.BoAppEventTypes) Handles SBO_Application.AppEvent
            Select Case EventType
                Case SAPbouiCOM.BoAppEventTypes.aet_ShutDown
                    SBO_Application.MessageBox("A Shut Down Event has been caught" & _
                        Environment.NewLine() & "Terminating 'Complex Form' Add On...")
                    '// Take care of terminating your AddOn application
                    System.Windows.Forms.Application.Exit()
            End Select
        End Sub
        Private Function SetConnectionContext() As Integer
            Dim sCookie As String
            Dim sConnectionContext As String
            ' Dim lRetCode As Integer
            '// First initialize the Company object
            oCompany = New SAPbobsCOM.Company
            '// Acquire the connection context cookie from the DI API.
            sCookie = oCompany.GetContextCookie
            '// Retrieve the connection context string from the UI API using the
            '// acquired cookie.
            sConnectionContext = SBO_Application.Company.GetConnectionContext(sCookie)
            '// before setting the SBO Login Context make sure the company is not
            '// connected
            If oCompany.Connected = True Then
                oCompany.Disconnect()
            End If
            '// Set the connection context information to the DI API.
            SetConnectionContext = oCompany.SetSboLoginContext(sConnectionContext)
        End Function
        Private Function ConnectToCompany() As Integer
            '// Make sure you're not already connected.
            If oCompany.Connected = True Then
                oCompany.Disconnect()
            End If
            '// Establish the connection to the company database.
            ConnectToCompany = oCompany.Connect
        End Function
        Private Sub SBO_Application_ItemEvent(ByVal FormUID As String, ByRef pVal As SAPbouiCOM.ItemEvent, ByRef BubbleEvent As Boolean) Handles SBO_Application.ItemEvent
            Dim oForm As SAPbouiCOM.Form
            oForm = SBO_Application.Forms.Item(FormUID)
            Dim oMatrix As SAPbouiCOM.Matrix
            Dim count As Integer
            Dim oDataSrc As SAPbouiCOM.DataSource
            Select Case pVal.EventType
                Case SAPbouiCOM.BoEventTypes.et_ITEM_PRESSED
                    '// Check if the event was raised by one of the Folder items
                    '// and change the form's pane level
                Case SAPbouiCOM.BoEventTypes.et_CLICK
                    ' If pVal.ItemUID = "1" And pVal.BeforeAction = True Then
                    'If oForm.Mode = SAPbouiCOM.BoFormMode.fm_ADD_MODE Or oForm.Mode = SAPbouiCOM.BoFormMode.fm_UPDATE_MODE Then
                    'If Validation() = False Then
                    'If oForm.Items.Item("OrdrVal").Specific().Value = "" Then
                    '    BubbleEvent = False
                    '    ' SBO_Application.MessageBox(" Please Enter  The Order No ")
                    '    SBO_Application.StatusBar.SetText("Enter The  Order  No - 3029 Item Is Not Selectable  ", SAPbouiCOM.BoMessageTime.bmt_Long, SAPbouiCOM.BoStatusBarMessageType.smt_Error)
                    '    oForm.Items.Item("OrdrVal").Click(SAPbouiCOM.BoCellClickType.ct_Regular)
                    '    Exit Sub
                    'End If
                    'If oForm.Items.Item("SupVal").Specific().Value = "" Then
                    '    BubbleEvent = False
                    '    ' SBO_Application.MessageBox(" Please Enter  The Order No ")
                    '    SBO_Application.StatusBar.SetText("Enter The  Supervisor - 3029 Item Is Not Selectable  ", SAPbouiCOM.BoMessageTime.bmt_Long, SAPbouiCOM.BoStatusBarMessageType.smt_Error)
                    '    oForm.Items.Item("SupVal").Click(SAPbouiCOM.BoCellClickType.ct_Regular)
                    '    Exit Sub
                    'End If
                    If pVal.FormMode = 2 And pVal.ItemUID = "1" And pVal.BeforeAction = False Then
                        'In UPDATE Mode
                        ' strDocNum = oForm.Items.Item("txtCode").Specific.String
                        ' If oForm.Mode = SAPbouiCOM.BoFormMode.fm_ADD_MODE And oForm.Mode = SAPbouiCOM.BoFormMode.fm_UPDATE_MODE Then
                        Dim strdocnum As String
                        strdocnum = oForm.Items.Item("DpsVal").Specific.String
                        oMatrix = oForm.Items.Item("Matrix1").Specific
                        oDataSrc = oForm.DataSources.DBDataSources.Add("@DPS1")
                        oForm.Freeze(True)
                        UpdateMatrixRowsDel(oForm)
                        oMatrix.FlushToDataSource()
                        For count = 1 To oMatrix.RowCount
                            oDataSrc.SetValue("LineId", count - 1, oDataSrc.GetValue("DocEntry", count - 1))
                        Next
                        oMatrix.LoadFromDataSource()
                        oForm.Freeze(False)
                    End If
                    '  End If
                    'End If
                    'End If
            End Select
            If pVal.EventType = SAPbouiCOM.BoEventTypes.et_CHOOSE_FROM_LIST Then
                Dim oCFLEvento As SAPbouiCOM.IChooseFromListEvent
                oCFLEvento = pVal
                Dim sCFL_ID As String
                sCFL_ID = oCFLEvento.ChooseFromListUID
                Dim oCFL As SAPbouiCOM.ChooseFromList
                oCFL = oForm.ChooseFromLists.Item(sCFL_ID)
                If oCFLEvento.BeforeAction = False Then
                    Dim oDataTable As SAPbouiCOM.DataTable
                    oDataTable = oCFLEvento.SelectedObjects
                    ''//Function to show values in EditBoxes and Matrix after pressing TAB button.
                    ShowAllData(pVal, oDataTable, oForm)
                End If
            End If
            Dim Matrix As SAPbouiCOM.Matrix
            Matrix = oForm.Items.Item("Matrix1").Specific
            'If ((pVal.ItemUID = "Matrix1") And (pVal.Row = Matrix.RowCount) And (pVal.EventType = SAPbouiCOM.BoEventTypes.et_KEY_DOWN)) Then
            '    ' Matrix.AddRow(1, -1)
            '    Matrix.AddRow(1, -1)
            '    Matrix.Columns.Item("#").Cells.Item(Matrix.RowCount).Specific.Value = Matrix.RowCount
            'End If
            If (FormUID = "SM_DPSFM") And (pVal.EventType = SAPbouiCOM.BoEventTypes.et_FORM_UNLOAD) Then
                Windows.Forms.Application.Exit()
            End If
            'ShowTripTotal(pVal, oForm)
            Dim i As Integer
            Dim tripsm As Integer = 0
            Dim triplat As Integer = 0
            Dim tripbax As Integer = 0
            Dim tripitm4 As Integer = 0
            Dim tripitm5 As Integer = 0
            If ((pVal.FormUID = "SM_DPSFM") And (pVal.EventType = SAPbouiCOM.BoEventTypes.et_ITEM_PRESSED) Or (pVal.EventType = SAPbouiCOM.BoEventTypes.et_KEY_DOWN)) Then
                For i = 1 To Matrix.RowCount
                       tripsm += Matrix.Columns.Item(3).Cells.Item(i).Specific.Value
                    oForm.Items.Item("Trip1Val").Specific().value = tripsm
                    triplat += Matrix.Columns.Item(4).Cells.Item(i).Specific.Value
                    oForm.Items.Item("Trip2Val").Specific().value = triplat
                    tripbax += Matrix.Columns.Item(5).Cells.Item(i).Specific.Value
                    oForm.Items.Item("Trip3Val").Specific().value = tripbax
                    tripitm4 += Matrix.Columns.Item(6).Cells.Item(i).Specific.Value
                    oForm.Items.Item("Trip4Val").Specific().value = tripitm4
                    tripitm5 += Matrix.Columns.Item(7).Cells.Item(i).Specific.Value
                    oForm.Items.Item("Trip5Val").Specific().value = tripitm5
                    Matrix.LoadFromDataSource()
                Next
            End If
        End Sub
        Private Sub SalesOrdrCFL(ByVal oForm As SAPbouiCOM.Form)
            Try
                Dim oCFLs As SAPbouiCOM.ChooseFromListCollection
                'Dim oCons As SAPbouiCOM.Conditions
                'Dim oCon As SAPbouiCOM.Condition
                oCFLs = oForm.ChooseFromLists
                Dim oCFL As SAPbouiCOM.ChooseFromList
                Dim oCFLCreationParams As SAPbouiCOM.ChooseFromListCreationParams
                oCFLCreationParams = SBO_Application.CreateObject(SAPbouiCOM.BoCreatableObjectType.cot_ChooseFromListCreationParams)
                ' Adding 2 CFL, one for the button and one for the edit text.
                oCFLCreationParams.MultiSelection = False
                oCFLCreationParams.ObjectType = "17"
                oCFLCreationParams.UniqueID = "CFL1"
                oCFL = oCFLs.Add(oCFLCreationParams)
                oCFLCreationParams.UniqueID = "CFL2"
                oCFL = oCFLs.Add(oCFLCreationParams)
            Catch
                MsgBox(Err.Description)
            End Try
        End Sub
        Private Sub OBRCFL(ByVal oForm As SAPbouiCOM.Form)
            Try
                Dim oCFLs As SAPbouiCOM.ChooseFromListCollection
                ' Dim oCons As SAPbouiCOM.Conditions
                ' Dim oCon As SAPbouiCOM.Condition
                oCFLs = oForm.ChooseFromLists
                Dim oCFL As SAPbouiCOM.ChooseFromList
                Dim oCFLCreationParams As SAPbouiCOM.ChooseFromListCreationParams
                oCFLCreationParams = SBO_Application.CreateObject(SAPbouiCOM.BoCreatableObjectType.cot_ChooseFromListCreationParams)
                ' Adding 2 CFL, one for the button and one for the edit text.
                oCFLCreationParams.MultiSelection = False
                oCFLCreationParams.ObjectType = "SM_OOBR"
                oCFLCreationParams.UniqueID = "CFL3"
                oCFL = oCFLs.Add(oCFLCreationParams)
                '' Adding Conditions to CFL1
                'oCons = oCFL.GetConditions()
                'oCon = oCons.Add()
                'oCon.Alias = "U_ordrdt" '"Order Date" '"U_ordrdt" '"Balance"
                'oCon.Operation = SAPbouiCOM.BoConditionOperation.co_EQUAL
                'oCon.CondVal = oForm.Items.Item("OrdrdtVal").Specific().string  '"120000"
                'oCFL.SetConditions(oCons)
            Catch
                MsgBox(Err.Description)
            End Try
        End Sub
        Private Sub itemlist(ByVal oForm As SAPbouiCOM.Form)
            Try
                Dim oCFLs As SAPbouiCOM.ChooseFromListCollection
                '  Dim oCons As SAPbouiCOM.Conditions
                '  Dim oCon As SAPbouiCOM.Condition
                oCFLs = oForm.ChooseFromLists
                Dim oCFL As SAPbouiCOM.ChooseFromList
                Dim oCFLCreationParams As SAPbouiCOM.ChooseFromListCreationParams
                oCFLCreationParams = SBO_Application.CreateObject(SAPbouiCOM.BoCreatableObjectType.cot_ChooseFromListCreationParams)
                ' Adding 2 CFL, one for the button and one for the edit text.
                oCFLCreationParams.MultiSelection = False
                oCFLCreationParams.ObjectType = "4"
                oCFLCreationParams.UniqueID = "CFL5"
                oCFL = oCFLs.Add(oCFLCreationParams)
                oCFLCreationParams.UniqueID = "CFL5"
                oCFL = oCFLs.Add(oCFLCreationParams)
                'oCFL = oCFLs.Add(oCFLCreationParams)
                'oCons = oCFL.GetConditions()
                'oCon = oCons.Add()
                'oCon.Alias = "ItemCode"
                'oCon.Operation = SAPbouiCOM.BoConditionOperation.co_START
                'oCon.CondVal = "V"
                'oCFL.SetConditions(oCons)
            Catch
                Exit Sub
                MsgBox(Err.Description)
            End Try
        End Sub
        Private Sub ShowAllData(ByRef pVal As SAPbouiCOM.ItemEvent, ByVal oDatatable As SAPbouiCOM.DataTable, ByVal oForm As SAPbouiCOM.Form)
            Dim val, val2, val4 As String
            Dim val1 As String
            Dim i As Integer
            Dim oCombo As SAPbouiCOM.ComboBox
            oCombo = oForm.Items.Item("LogVal").Specific
            Dim Matrix As SAPbouiCO

  • Copying custom and system documents via SDK

    Hi everyone,
    A client needs to copy Purchase Order document to AR Invoice.
    Looks like that the only way to implement this feature is to straightly set matrix cells' values, for example
    var itemCode0 = InvoiceFormMatrix.Columns.Item("0").Cells.Item("0").Specific as EditText;
    itemCode0.Value = "Code00";
    So, the first question - is it any faster way to fill system matrixes? I've already tryed DBDataSource.SetValue() and Matrix.SetCellWithoutValidation() - they are forbidden to change system columns.
    The second question: matrix.AddRow() method doesn't increment the "#" column (Line Number) automatically, even after form.Update() call. How can I fix this issue?

    Hi Ankit,
    Yestarday I implemeted a similar approach. However, this sollution has several shortcomings:
    Extremely slow behaviour - it is obvious, however
    As I mentioned earlier - "#" column is filled with "1"-s - no automatic incrementation.
    I cannot set Description column, because it raises "ChooseFromList" if several ItemCodes has the same Description. First I set ItemCode, however, SDK doesn't set the corresponding Description automatically as one might expect. Suppressing ChooseFromList event "before action" (BubbleEvent = false) leads to emty Description column.
    Thus, I have a bunch of problems against a few benefits ...
    Hi Ady,
    "Why don't you use DI API to copy the SO to Draft AP Invoice" - this is the client demand. He needs such "Copy From" feature according to his business process. Also he opposes to any auxillary documents which could easily confuse inexperienced user of SAP B1.
    Best regards, Evgeny.

  • Control sort order of UDO Child

    Hey All,
    Can anyone tell me how I can control the display order of a document UDO lines matrix? We have document lines created that have a date in the data and the client would like the data to display with the newest entries on top.
    Anyone know how I can do this?

    I can see one possibility, but I have never tried it on a UDO screen.  Basically I am thinking you might be able to use a variation on a technique I described previously for adding sorting into a DBDatasource based screen
    Re: Sort data in matrix using DBDataSources
    Theoretically this might work for your UDO although you would also need to handle the fact that the UDO itself will be attempting to auto-populate the matrix whereas in my previous posting the matrix population was always under user control. (Either matrix.clear or set bubbleevent = false might handle this additional complexity)
    I think you could probably end up with something like the following
    - Intercept MATRIX_LOAD event
    - ??matrix.Clear??
    - **Populate Array from dbdatasource & Quicksort it**
    - for counter = 0 to (DBDataSource.Size - 1)
    -    Set offset on DBDataSource to **offset from Array**
    -    Matrix.Addrow
    - next
    - ??BubbleEvent = false??
    I have never tried it so it might not work out when it comes to updating, but on the plus side it should be pretty quick to add into an existing screen to test.
    One final thought - For a <b>really</b> quick test to see if it is likely to work before going to the trouble of introducing the array & proper sorting routine, simply loop through the dbdatasource from last record down to first record and see if everything still works with the rows displayed in reverse order.
    eg.
    - Intercept MATRIX_LOAD event
    - ??matrix.Clear??
    - for (DBDataSource.Size - 1) to Counter Step -1
    -    Set offset on DBDataSource to counter
    -    Matrix.Addrow
    - next
    - ??BubbleEvent = false??
    Hope it works out,
    John.

  • Problem with events

    Hello
    Forgive me if this is too simple or too obvious but I`m complete beginner and here is my probelm -
    I`am trying to modify a matrix after it has been created. Something as simple as adding rows programmatically.
    I tried Form Load and Form Activate events but it gave me some errors. Basically it seems that there is lag between creating
    form for the first time and populating it with items. Funny thing is that it works second time Form Activate event fires.
    On first occurence of this event it complains with "Invalid item..." message. That item is my matrix object. Second occurence and
    bing, it works. What am I missing? What fundamental I don`t know about events?
    Thanks in advance
    Kamil

    Thanks Mark but I already set before property to false. Still it does not work. In case of Form Activate event it does not work the
    first time it is fired in my form`s lifetime. Then I click on, let`s say, main menu, then go back to my form and this time it works.
    The error message I get is -
    EXCEPTION: Form__CTPRPL.OnAfterFormActivate raised
    Item Invalid Item [66000-3]. Form Unique Id:'CT_PRPL_0' Item
    Unique Id: 'mtx_0'
    Here is the code fragment in question
    [B1Listener(BoEventTypes.et_FORM_ACTIVATE, false)]
            public virtual void OnAfterFormActivate(ItemEvent pVal)
                    Form form = B1Connections.theAppl.Forms.Item(pVal.FormUID);
                    Item item = form.Items.Item("mtx_0");
                    Matrix matrix = (Matrix)item.Specific;
                    matrix.AddRow(20, 0);
                // ADD YOUR ACTION CODE HERE ...
    Thanks
    Kamil

  • UDO, Context menu

    Hi All,
    I am developing a UDO form. I need to make "Context Menu" -> "Insert Row" work.
    I've seen in the forum, that I need to program this myself. The problem is that I can not figure out how to find the number of the row where the cursor is placed when the user right clicks to get the context menu.
    I can make things work if I select the line first (make it orange) and then use the function Matrix.GetNetSelectedRow, but the built-in functionality of Delete Line does not require that I select the row first.
    Any help appriciated
    Rgds
    Jesper Carstensen

    I capture the row number using this code in ItemEvent:
    If pVal.ItemUID = "MyMatrixUID" And pVal.EventType = et_Click And pVal.BeforeAction = False Then
      If pVal.Row > 0 Then
        myRow = pVal.Row
      Else
        myRow = 0
      End If
    End If
    Applying the row number to your Matrix.AddRow method should do the trick.
    I hope the above helps.

Maybe you are looking for

  • Oracle 8.1.7.3 on Linux 7.2 linking problem.

    I am installing Oracle 8.1.7.3 on Linux. I successfully get the installer to run and can install Oracle. However, when I perform the link part of the install it fails. I am following the procedure of changing the compatibility libraries for Linux. I

  • Adding one day to a oracle.jbo.domain.Date and truncating the time part

    JDev 11.1.1.4.0 Hello I need to add a day to oracle.jbo.domain.Date and get back a oracle.jbo.domain.Date without the time part. So far I've got Date valueDate = (Date)rowCpt.getAttribute("ValueDate");                                        Calendar

  • The BADI AND FM involved in mentioning the number of digits for Price

    Hi,   Please mention me the name of BADI & Functional module(or if report program) involved in validating the number of digits entered for the field price while creating Shopping cart. i am eagerly waiting for the answer. regards, George.

  • Cell Text Annotations of Hyperion Planning on Hyperion Financial Reporting

    Hello, There is a business requirement to show Cell text entered as annotation on each cells in data form to be reported using Hyperion Financial Reporting. Also there is a case of some of the data types being text. Some of the forms also have suppor

  • Keep Getting Internal Server Error

    I keep getting the following message mostly after I click to send an email.  I would appreciate any help I could get on this one!  Thank you!   The server failed to send back valid XML. Please contact Verizon Yahoo! Customer Care and let them know wh