Purpose
Select a grid row

Solution
Use the predefined VB function
   guinet.GridControl.SelectRowByValue

specifying the cell content and the column id.

If you know the row number, you may use
   guinet.GridControl.SelectRow
  
Examples:
 
CallVBAsync guinet.GridControl.SelectRowByValue "PALO ALTO" column:="VARIANT"

or
 CallVBAsync guinet.GridControl.SelectRow  1

In some grid controls, it is necessary to use the "ClickCellByValue" function in order to select the given entry:

  CallVBAsync guinet.GridControl.ClickCellByValue "PALO ALTO" column:="VARIANT"


Example

We want to automate transaction IH08 (equipment list) by selecting a particular list variant. The variant directory is displayed in a grid control:

 

InputScript  

// start transaction IH08
Enter "/NIH08"

// Display the variant directory
Screen RIEQUI20.1000
  Enter "/17"

// Select a particular variant
Screen SAPLSVAR.0600
 
CallVBAsync guinet.GridControl.SelectRowByValue "PALO ALTO" column:="VARIANT"
 
Enter

// Start the list display
Screen RIEQUI20.1000
Enter "/8"

 

If the variant "PALO ALTO" is missing in the system, an error popup is displayed:

 

The popup does not indicate that the variant "PALO ALTO" is missing. It is good practice to handle such errors explicitely in the InputScript and show an error message which clearly indicates what is going wrong. In our case we can add the error popup in the InputScript and then terminate the script with our own error message:

InputScript  

// start transaction IH08
Enter "/NIH08"

// Display the variant directory
Screen RIEQUI20.1000
  Enter "/17"

// Select a particular variant
Screen SAPLSVAR.0600
 
CallVBAsync guinet.GridControl.SelectRowByValue "PALO ALTO" column:="VARIANT"
 
Enter

// Error message popup?
 
Screen SAPMSDYP.0010
 
  Message "E: Variant PALO ALTO missing for transaction IH08" -statusline
 
  Enter "/N"
 
  Leave

// Start the list display
Screen RIEQUI20.1000
Enter "/8"

 

Components
InputAssistant + Controls