cancel
Showing results for 
Search instead for 
Did you mean: 

Refer a Grid and click a selected row programmatically

Former Member
0 Kudos

Hi,I was trying to get find selected rows in the grid below find textbox in packages screen.I am unable to refer the grid using the below code it throws me an exception.Should the grid be refereed using item number or does it have a name i have attached a screen shot of the grid . Am new to SAP B1 please help me how to refer a grid and select its content .

public SAPbouiCOM.Grid grd;

private SAPbouiCOM.Form oForm;

SAPbouiCOM.Item oItem = null;

oForm = SapApp.Forms.GetForm("60017", 1);//60017 refers to packages screen

grd =oForm.Items.Item("9").Specific;

the exception i get is Unable to cast COM object of type 'System.__ComObject' to interface type 'SAPbouiCOM.Grid'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{856B9291-F296-4A2E-8EB8-FF9189E23425}' failed due to the following error: No such interface supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE)).

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

its because thats not grid but matrix...

Former Member
0 Kudos

thanks a lot peter i did not get the exception now..How can we differentiate between a matrix and grid ...and how to find selected rows in a matrix please help

Former Member
0 Kudos

thanks Petr you made it work..but please tell me how to differentiate a grid and a matrix..Even in the screen shot it shows Define Packages Grid2,hence it was trying to cast it to a  grid.

Answers (0)