2017-07-12 2 views
0

Je veux scripter notre sève. En fait, je suis en train de scripter les comboboxes. Mais je ne sais pas, comment sélectionner un élément spécifique.Comment sélectionner une entrée GuiComboBox dans SAP

SAPFEWSELib.dll inclus comme 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; 

}

Est-ce que quelqu'un a une idée?

Répondre

0

Ok, j'ai compris.

GCB.Value = Entry.Value; 

Dans mon test, la liste déroulante n'était pas modifiable, donc elle n'a jamais fonctionné.