Hi Prince,
Try this code. I hope it will help u...
************************************************
Dim objmatrix As SAPbouiCOM.Matrix
objmatrix = objform.Items.Item("UniqueID").Specific
Dim orec As SAPbobsCOM.Recordset
orec = objSBOAPI.oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)
Dim str As String
str = "SELECT Code,Name FROM [@tablename] ORDER BY Code ASC"
orec.DoQuery(str)
Dim i As Integer = 1
While Not orec.EoF
objmatrix.AddRow()
objmatrix.Columns.Item("0").Cells.Item(objmatrix.VisualRowCount).Specific.value = objmatrix.VisualRowCount
objmatrix.Columns.Item("1").Cells.Item(i).Specific.value = orec.Fields.Item("Code").Value
objmatrix.Columns.Item("2").Cells.Item(i).Specific.value = orec.Fields.Item("Name").Value
i = i + 1
orec.MoveNext()
End While
***************************************************
Thanks & Regards,
P.T.Sampath.