Quantcast
Channel: SCN : All Content - All Communities
Viewing all articles
Browse latest Browse all 3523

Automatic filling a column matrix from query

$
0
0

Hi All,

 

 

I have created an UDO which contains a matrix and i want to fill that matrix from a SQL query.

 

My matrix contains 5 columns and the query returns 3 columns (the two last columns must be filled manually).

 

After creating an UDO, I create sdk code using VB.net  but fail. I need your help to solve this issue.

 

Here is my code:

 

#Region " ItemEvent Handler matrix payment "

    Public Sub ItemEvent_Handler_Matrix(ByVal FormUID As String, ByRef pVal As SAPbouiCOM.ItemEvent, ByRef BubbleEvent As Boolean)

Try

If pVal.ColUID = "INTSNo" Then

                    If pVal.EventType = SAPbouiCOM.BoEventTypes.et_CLICK Then

                        If pVal.BeforeAction = False And pVal.Row <> 0 Then

                            Dim oMatrix As SAPbouiCOM.Matrix

                            Dim oForm As SAPbouiCOM.Form

                            Dim oEditText As SAPbouiCOM.EditText

                            Dim oRecordSet As SAPbobsCOM.Recordset

                            oForm = SBO_Application.Forms.Item(FormUID)

                            oMatrix = CType(oForm.Items.Item("mtxPymnt").Specific, SAPbouiCOM.Matrix)

 

                            oEditText = CType(oMatrix.Columns.Item("SRNNo").Cells.Item(pVal.Row).Specific, SAPbouiCOM.EditText)

                            oRecordSet = CType(oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset), SAPbobsCOM.Recordset)

                            oRecordSet.DoQuery("select a.u_INTSNo as INTSNO " & _

                                                "from OWTR a inner join WTR1 b on b.docentry=a.docentry inner join OITM c on c.itemcode = b.itemcode where c.[ManSerNum] ='Y' and " & _

                                                "a.comments = " & oEditText.Value.ToString)

 

 

                            If oEditText.Value <> "" Then

                                SBO_Application.Forms.Item(FormUID).DataSources.DBDataSources.Item("@UDT_PYMNT_D").SetValue("U_INTSNO", 0, CType(oRecordSet.Fields.Item("INTSNo").Value, String))

                                oMatrix.Columns.Item("INTSNo").Cells.Item(pVal.Row).Click()

                            Else

                                SBO_Application.SetStatusBarMessage("INTS No. does not exist", SAPbouiCOM.BoMessageTime.bmt_Short, True)

                                oMatrix.Columns.Item("INTSNo").Cells.Item(pVal.Row).Click()

                            End If

                        End If

                    End If

                End If

Catch ex As Exception

            SBO_Application.MessageBox(ex.Message)

            BubbleEvent = False

        End Try

end sub

 

I recognize that i'm too new at SAP B1 SDK.

 

Thanks in advance!

 

Rgds,
Steve


Viewing all articles
Browse latest Browse all 3523

Trending Articles