Skip to Content
0

Fill Data through Execute query in Grid

May 21, 2017 at 05:34 AM

237

avatar image
Former Member

Dear ,

I fill data through execute query in Grid. but my program through error Matrix Invalid column no.

one field not accept more than 40 character in grid i will try fill data more than 40 character in filed than program through Error - Matrix invalid column no .

whereas this column accept less than 40 character in grid than program not through any error or exception .

code:

Dim strCol As String = oRecordset.Fields.Item("U_QUESTION").Value
Dim strAns As String = oRecordset.Fields.Item("U_ANSWER").Value
Dim strArr() As String oHashTable.Add(iHashKey, oRecordset.Fields.Item("U_QSTID").Value) oGridQuest.DataTable.Columns.Add(strCol, SAPbouiCOM.BoFieldsType.ft_AlphaNumeric, 50) If oRecordset.Fields.Item("U_ANSMOD").Value = "COMBOBOX" Then
oGridQuest.Columns.Item(strCol).Type = SAPbouiCOM.BoGridColumnType.gct_ComboBox strArr = strAns.Split("|")
If strArr.Count > 0 Then
For iCount As Integer = 0 To strArr.Count - 1
oGridQuest.Columns.Item(strCol).ValidValues.Add(strArr(iCount), strArr(iCount))
Next
End If Else
oGridQuest.Columns.Item(strCol).Type = SAPbouiCOM.BoGridColumnType.gct_EditText
End If oRecordset.MoveNext()
iHashKey = iHashKey + 1
End While

9.2 pl 7

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

2 Answers

ANKIT CHAUHAN
May 21, 2017 at 07:10 AM
0

Hi Mohammad,

I have used a sample code as below to fill the Grid with a result of the query:

string Sql = "Select SelectRow as 'Select', ItemCode as 'Item Code', ItemName as 'Item Name', Qty as 'Qty.', DocRef , LineID , ProjectDescription as 'Project Details', Project From [@TEMPTABLEFORMATERIALREQUEST] Where UserLogin = '" + SBO_Company.UserName + "'";


this.m_SBO_Form.DataSources.DataTables.Add("MYDATATABLE");
this.m_SBO_Form.DataSources.DataTables.Item(0).Clear();
this.m_SBO_Form.DataSources.DataTables.Item(0).ExecuteQuery(Sql);
SAPbouiCOM.Grid oGrid = (Grid)this.m_SBO_Form.Items.Item(enControlName.Grid).Specific;
oGrid.DataTable = this.m_SBO_Form.DataSources.DataTables.Item("MYDATATABLE");
SAPbouiCOM.EditTextColumn oEditColumn;
oEditColumn = ((SAPbouiCOM.EditTextColumn)(oGrid.Columns.Item("DocRef")));
oEditColumn.Visible = false;
oEditColumn = ((SAPbouiCOM.EditTextColumn)(oGrid.Columns.Item("LineID")));
oEditColumn.Visible = false;
oEditColumn = ((SAPbouiCOM.EditTextColumn)(oGrid.Columns.Item("Select")));
oEditColumn.Type = BoGridColumnType.gct_CheckBox;
oEditColumn = ((SAPbouiCOM.EditTextColumn)(oGrid.Columns.Item("Item Code")));
oEditColumn.Editable = false;
oEditColumn = ((SAPbouiCOM.EditTextColumn)(oGrid.Columns.Item("Item Name")));
oEditColumn.Editable = false;
oEditColumn = ((SAPbouiCOM.EditTextColumn)(oGrid.Columns.Item("Qty.")));
oEditColumn.Editable = false;
oEditColumn = ((SAPbouiCOM.EditTextColumn)(oGrid.Columns.Item("Project Details")));
oEditColumn.Editable = false;
oEditColumn = ((SAPbouiCOM.EditTextColumn)(oGrid.Columns.Item("Project")));
oEditColumn.Visible = false;
oGrid.AutoResizeColumns();
oEditColumn = ((SAPbouiCOM.EditTextColumn)(oGrid.Columns.Item("Item Code")));
oEditColumn.LinkedObjectType = "4";

Hope this will enable you to find out the error in your program!

Kind regards,

ANKIT CHAUHAN

SAP SME Support

Share
10 |10000 characters needed characters left characters exceeded
avatar image
Former Member May 22, 2017 at 06:01 AM
0

through error : Public member 'Column' on type 'IGrid' not found

Share
10 |10000 characters needed characters left characters exceeded