SapGuiSelectTopNode Function

Action

Scrolls to a specified node in the SapGui tree control.

Include file

SapGui.bdh

Syntax

SapGuiSelectTopNode( in sControlId : string allownull, 
                     in sNodeName  : string, 
                     in sTopNode   : string,
                     in sTimer     : string optional ) : boolean;
Parameter Description
sControlId The tree's unique id.
sNodeName The name of the node to be expanded. Silk Performer will try to look up the node by matching the node name. If it cannot find the node by the name or if the name is not unique, specify the node id in the third parameter.
sNode The node id identifying the node.
sTimer Timer name used for measurements.

Return value

  • true if successful
  • false otherwise

Example

transaction TMain
  var
    sConnID : string;
  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
    // Before running a test you have to customize the password parameter!
    SapGuiIgnoreError(SAPENGINE_STATUSBAR_CHANGED, SEVERITY_SUCCESS);
    ThinkTime(3.3);
    SapGuiLogon("ddic", "*******", "000", "");

    // Copyright
    SapGuiSetActiveWindow("wnd[1]", "Copyright", SAPGUI_MATCH_Exact);
    SapGuiPressButton("tbar[0]/btn[0]");

    // SAP Easy Access
    ThinkTime(3.9);
    SapGuiSetActiveWindow("wnd[0]", "SAP Easy Access", SAPGUI_MATCH_Exact);

    // NodeName: Office
    // NodePath: 2\1
    SapGuiTreeExpandNode("usr/cntlIMAGE_CONTAINER/shellcont/shell/shellcont[0]/shell", "Office", 
    "0000000003", "Expand\\Office");

    // NodeName: Workplace
    // NodePath: 2\1\1
    SapGuiTreeSelectNode("usr/cntlIMAGE_CONTAINER/shellcont/shell/shellcont[0]/shell", "Workplace", 
    "0000000004", false, "SelNode\\Workplace");

    // NodeName: Favorites
    // NodePath: 1
    SapGuiSelectTopNode("usr/cntlIMAGE_CONTAINER/shellcont/shell/shellcont[0]/shell", "Favorites", 
    "Favo", "TopNode\\Favorites");

    // NodeName: Workplace
    // NodePath: 2\1\1
    SapGuiTreeDblClickNode("usr/cntlIMAGE_CONTAINER/shellcont/shell/shellcont[0]/shell", "Workplace", 
    "0000000004", "DblClNode\\Workplace");
    // Grid Control Info:
    // /app/con[0]/ses[0]/wnd[0]/usr/cntlSINWP_CONTAINER/shellcont/shell/shellcont[1]/shell/shellcont[0]/shell/0 columns
    // -------------------------------------

    // Business Workplace von DDIC
    ThinkTime(2.6);
    SapGuiSetActiveWindow("wnd[0]", "Business Workplace von DDIC", SAPGUI_MATCH_Exact);
    SapGuiPressButton("tbar[0]/btn[15]");

    // SAP Easy Access
    SapGuiSetActiveWindow("wnd[0]", "SAP Easy Access", SAPGUI_MATCH_Exact);

    // NodeName: Office
    // NodePath: 2\1
    ThinkTime(2.2);
    SapGuiTreeSelectNode("usr/cntlIMAGE_CONTAINER/shellcont/shell/shellcont[0]/shell", "Office", 
    "0000000003", false, "SelNode\\Office");

    // NodeName: Office
    // NodePath: 2\1
  end TMain;