SapGuiIteratorGetObject Function

Action

This function provides the value of the iterator’s current position. This function will provide a handle to the object at the current position, unless the object at the current position is of a simple type such as long or boolean or string. Then the function SapGuiIteratorGetValue has to be used. The returned object handle has to be freed by calling SapGuiObjectFree when no longer needed.

Include file

SapGui.bdh

Syntax

SapGuiIteratorGetObject( in  nIterator : number,
                         out nObject   : number ) : boolean;
Parameter Description
nIterator The handle to the collection iterator.
nObject This parameter will be assigned the handle to the object.

Return value

  • true if successful
  • false otherwise

Example

transaction TMain
  var
    sConnID   : string;
    sKey      : string;
    sValue    : string;
    nIterator : number;
    nObject   : number;
    nType     : number;
  begin

    // Connecting to SAP
    sConnID := SapGuiOpenConnection(" /SAP_CODEPAGE=1100 /FULLMENU 10.5.2.198 0 /3");
    SapGuiSetActiveConnection(sConnID);
    SapGuiSetActiveSession("ses[0]");
  
    // SAP
    SapGuiSetActiveWindow("wnd[0]", "SAP", SAPGUI_MATCH_Exact);
    SapGuiWindowAction(SAPGUI_WND_MAXIMIZE);
  
    // Logon to SAP System
    SapGuiIgnoreError(SAPENGINE_STATUSBAR_CHANGED, SEVERITY_SUCCESS);
    ThinkTime(2.8);
    SapGuiLogon("ddic", "minisap", "000", "");
  
    // Copyright
    ThinkTime(2.1);
    SapGuiSetActiveWindow("wnd[1]", "Copyright", SAPGUI_MATCH_Exact);
    SapGuiPressButton("tbar[0]/btn[0]");
  
    // SAP Easy Access
    ThinkTime(9.9);
    SapGuiSetActiveWindow("wnd[0]", "SAP Easy Access", SAPGUI_MATCH_Exact);
    SapGuiGetComboboxEntries("usr/tblRSDEMO02TC_COLS/txtDEMO_CPROP-GROUP4", nIterator);
    while SapGuiIteratorHasMore(nIterator) do
      SapGuiIteratorFetchNext(nIterator);
      SapGuiIteratorGetValue(nIterator, sValue, nType);
      if (nType = SAPGUI_VT_DISPATCH) then
        SapGuiIteratorGetObject(nIterator, nObject);
        SapGuiObjectGetProperty(nObject,"Key", sKey);
        SapGuiObjectGetProperty(nObject, "Value", sValue);
        SapGuiObjectFree(nObject);
      end;
    end;
  
   SapGuiIteratorRelease(nIterator);
  end TMain;