cancel
Showing results for 
Search instead for 
Did you mean: 

error occur when retrieve oGrid value from the existing FormUsingOveridable

Former Member
0 Kudos
83

hi, i was trying to get oGrid value from the existing screen, Batch Number Selection. So, i was using the Overidable based on form id.

i put the below code in the initialize method , but got this error .Any idea or solution ?

Thanks.

Code

====================================

Dim oRefItem As SAPbouiCOM.Item

oRefItem = Form.Items.Item("4")

oGrid = oRefItem.Specific

For i As Integer = 0 To oGrid.Rows.Count - 1

BaseAddOn.Application.MessageBox(oGrid.DataTable.GetValue(0, i))

Next

==========================================

Error

=========================================

System.InvalidCastException: 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_member933888
Active Participant
0 Kudos

hi elsonSAP,

Do you put your code at the correct form to manipulated?

eg. something like this..

Pval.FormTypeEx="42" ' 42 is the batch form ID,

nd.Q

Edited by: Andy Quipit Sayus on Sep 2, 2011 7:36 AM

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Elson,

Its Working fine in my system

Try This......


Dim igrid As SAPbouiCOM.Grid
                Dim oRefItem As SAPbouiCOM.Item
                oform = sbo_application.Forms.Item(pVal.FormUID)
                oRefItem = oform.Items.Item("grid")
                igrid = oRefItem.Specific

                For i As Integer = 0 To igrid.Rows.Count - 1
                    sbo_application.MessageBox(igrid.DataTable.GetValue(2, i))
                Next

Thanks

Shafi