javasap-gui

Unable to GetCellValue from GUIGridView in sap-gui


I have a project using the jacob project to automate SAP gui automation (version 7.70). I'm able to access a GuiGridView as an ActiveXComponent. The subtype shows it's a GridView when I call grid.getPropertyAsString("SubType"). The visible row count returned is correct when I call Dispatch.call(grid, "VisibleRowCount").toString(). Double clicking a cell does not error when I call Dispatch.call(grid, "DoubleClickCurrentCell"). However, I'm unable to get past an error occurring when I try to get a cell value via Dispatch.call(grid, "GetCellValue", Integer.valueOf(1), "Synchronization Object"). I get an error

com.jacob.com.ComFailException: A COM exception has been encountered:
At Invoke of: GetCellValue
Description: 80004003 / Invalid pointer

Trying to wrap them in an array of objects like I've seen done in the PoojaGugu library I get:

com.jacob.com.ComFailException: A COM exception has been encountered:
At Invoke of: GetCellValue
Description: 80020005 / Type mismatch.

And trying to pass them in as Variants, I get:

At Invoke of: GetCellValue
Description: 8000000a / The data necessary to complete this operation is not yet available.

Any suggestions about what I might be overlooking or where I'm going wrong with this?


Solution

  • Ok, I figured it out. The format of

    Dispatch.call(grid, "getCellValue", 3, "ID")
    

    was correct, but I needed to use the column identifier (like ID or RL_FROM_T) rather than the column name (like "Synchronization Object" or "From Release").