Robotic Process Automation (RPA)

 View Only
Expand all | Collapse all

Handling Clicking on GridView cell in SAP Automation

  • 1.  Handling Clicking on GridView cell in SAP Automation

    Posted Fri September 02, 2022 09:20 AM
    Hi everyone!

    I have been trying unsuccessfully to click on cell within a SAP GridView. Inside this cell there is a checkmark control to select all rows in the grid view.



    Code:

    click --selector "Id" --controlsimilarity 100 --id "wnd[0]/usr/cntlGRID1/shellcont/shell/Cell(1,1)" --comment "Handling GridView cell using cell reference"

    (also with Cell(2,1), Cell(2,Select ALL), ...)

    I used cell position reference as per the documentation "Handling GridView controls in SAP automation" (https://www.ibm.com/docs/en/rpa/21.0?topic=automation-handling-gridview-controls-in-sap)

    I also have tried using ImageGrid, using Vision selector option… I even try sending "CTRL+A" by using "Send Keys" command.

    No method seems to be right one... For example for the above code, I got the following error (not all the options threw errors, some of them simply do nothing):

    System.ArgumentException
       at System.RuntimeType.ForwardCallToInvokeMember(String memberName, BindingFlags flags, Object target, Int32[] aWrapperTypes, MessageData& msgData)
       at SAPFEWSELib.ISapGridViewTarget.Click(Int32 Row, String Column)
       at AGej40COy92memEoEm.HyLQhVtdQjW03J7JKH.Click(MouseEmulationModes  )
       at WDG.Automation.Windows.ClickCommand.wcssW8oQjt(IControl  , Nullable`1  , Int32  , Int32  , Boolean  , Boolean  )
       at WDG.Automation.Windows.ClickCommand.<PerformClickCommand>d__75.MoveNext()
    --- End of stack trace from previous location where exception was thrown ---
       at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
       at WDG.Automation.Windows.ClickCommand.<ExecuteCore>d__74.MoveNext()
    --- End of stack trace from previous location where exception was thrown ---
       at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
       at WDG.Automation.Language.ErrorHandler.S35uKe5reZ(Exception  )
       at WDG.Automation.Language.ErrorHandler.HandleExecutionExceptionIfNeeded(Exception exception, IAutomationCommand command)
       at WDG.Automation.Language.CommandInterpreter.<Run>d__12.aU5hiHAeLc7OV3MJNiw(Object , Object , Object )
       at WDG.Automation.Language.CommandInterpreter.<Run>d__12.MoveNext()
    --- End of stack trace from previous location where exception was thrown ---
       at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
       at WDG.Automation.Language.ScriptInterpreter.<RunCore>d__17.MoveNext()



    Any suggestion?

    ---------------
    Maria C Palla

    ------------------------------
    MARIA CONCEPCION PALLA MORO
    ------------------------------


  • 2.  RE: Handling Clicking on GridView cell in SAP Automation

    Posted Tue September 20, 2022 07:02 AM

    Hi Maria,

    Have you tried using SAP Script Recording to record this click and run the .vbs script with the runWindowsScript command?
    If you haven't tried, in the SAP GUI top menu click on the monitor icon (Customize Local Layout) and click on the "Script Recording and Playback" option, in the window that opens click on the More button and in the "Save To" field type the path where the .vbs script will be saved (in the example code below I saved in the path C:\SapScript.vbs), record the click or the actions that you need the robot to do and after finishing add the following line to your .wal script:

    runWindowsScript --scripttype "VBScript" --source "File" --file "C:\\SapScript.vbs" --blockexecution

    You can also change the value of the source parameter to "Text" and copy the contents of the .vbs script directly to the "Code" field of the runWindowsScript command.



    ------------------------------
    Pedro Botolli Santos
    ------------------------------