cancel
Showing results for 
Search instead for 
Did you mean: 

Loading Values into a Grid

Former Member
0 Kudos

Hi All,

i am taking a employee id from ohem and populating it in my query to get the entire information.when i am populating i am getting only on employee id.how to get all the employee id's information at a time

my code is as follows

strQuery = "SELECT empid FROM [OHEM]"

objRecordSet.DoQuery(strQuery)

If objRecordSet.RecordCount > 0 Then

For inti As Integer = 0 To objRecordSet.RecordCount - 1

strEmployeeNo = objRecordSet.Fields.Item(0).Value

strGridQuery = "SELECT pf,basic,deductions etc where empid=''stremployeeno"

objRecordSet.MoveNext()

Next

here i am getting the information of only first employee

i am having a list of 12 employees

how to get all the employees

i wrote the query also as

strGridQuery += "SELECT pf,basic,deductions etc where empid=''stremployeeno"

regards

Micheal

Edited by: Micheal Vasanth on Sep 4, 2008 1:03 PM

Accepted Solutions (1)

Accepted Solutions (1)

Nussi
Active Contributor
0 Kudos

Hi Michael,

i don't get the point

why you fill the grid like this c# sample:

.
oForm.DataSources.DataTables.Add("MyDataTable");
 
((SAPbouiCOM.Grid)(oForm.Items.Item("grid").Specific)).DataTable = oForm.DataSources.DataTables.Item("MyDataTable");
 
oForm.DataSources.DataTables.Item(0).ExecuteQuery("select empID, lastName, FirstName, jobTitle from ohem");
 
((SAPbouiCOM.Grid)(oForm.Items.Item("grid").Specific)).CollapseLevel = 1;
((SAPbouiCOM.Grid)(oForm.Items.Item("grid").Specific)).AutoResizeColumns();
 
((SAPbouiCOM.Grid)(oForm.Items.Item("grid").Specific)).SelectionMode = SAPbouiCOM.BoMatrixSelect.ms_Single;

.

you see i inserted this query in executequery

select empID, lastName, FirstName, jobTitle from ohem

(extend it with your needs)

the grid will be filled with all emploeyees and the information from the select

lg David

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi,

Try this Code:

Dim oGrid As SAPbouiCOM.Grid

oGrid = oForm.Items.Item("Grid").Specific

oForm.DataSources.DataTables.Add("Table")

oGrid.DataTable = oForm.DataSources.DataTables.Item(Table")

strGridQuery = "SELECT empid ,pf,basic,deductions etc where empid in

(SELECT empid FROM OHEM) order by empid "

oForm.DataSources.DataTables.Item(0).ExecuteQuery(strGridQuery )

oGrid.CollapseLevel = 1

oGrid.AutoResizeColumns()

Kind Regards

Mohana

Former Member
0 Kudos

Hi,

Dim oForm As SAPbouiCOM.Form

Dim oGrid As SAPbouiCOM.Grid

oGrid = oForm.Items.Item("4").Specific

oForm.DataSources.DataTables.Add("D_1")

oGrid.DataTable = oForm.DataSources.DataTables.Item("D_1")

strGridQuery = "SELECT empid ,pf,basic,deductions etc where empid in

(SELECT empid FROM OHEM) order by empid "

oForm.DataSources.DataTables.Item(0).ExecuteQuery(strGridQuery )

oGrid.CollapseLevel = 1

oGrid.AutoResizeColumns()

try this code.

u can get all vales for all employess & it will come employee wise