0

I want to script our sap. Actually, I'm scripting the comboboxes. But I don't know, how to select a specific item.

SAPFEWSELib.dll included as refernece

public static bool SelectComboBoxItem(string ItemText)
{
int i = 0, ItInd = -1;
SAPFEWSELib.GuiComboBox GCB = GetComboBox(GFW, Criteria, Type); /*This function returns the SAPFEWSELib.GuiComboBox and works correctly*/

if (GCB != null)
{
    foreach (SAPFEWSELib.GuiComboBoxEntry Entry in GCB.Entries)
    {
        if (Entry.Value.ToUpper().IndexOf(Item.ToUpper()) != -1)
        {
            /*How to select this Entry?*/
            /*GCB.Entries.Item(Entry.Pos).Select() is a not contained methode*/
            /*GCB.Entries.Item(Entry.Pos).Selected = true This functions for GuiTableRows and GuiGridViewRows, but not here*/
            return true;
        } else {
            i++;
        }
    }
}else{
    throw new System.Exception("ERROR: Unable to find combobox with current criteria!");
}

return false;

}

Does anybody has an Idea?

Sandra Rossi
  • 11,934
  • 5
  • 22
  • 48
Jan021981
  • 521
  • 3
  • 28

1 Answers1

0

Ok, got it.

GCB.Value = Entry.Value;

In my testcase, the combobox was not changeable, so it never functioned.

Jan021981
  • 521
  • 3
  • 28