SapGuiTreeCollapseNode Function

Action

Collapses a specified node of a specified tree control.

Include file

SapGui.bdh

Syntax

SapGuiTreeCollapseNode( in sControlId : string allownull,
                        in sNodeName  : string,
                        in sNode      : string,
                        in sTimer     : string optional ) : boolean;
Parameter Description
sControlId The tree's unique id.
sNodeName The name of the node to be collapsed. 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
    SapGuiTreeCollapseNode("usr/cntlIMAGE_CONTAINER/shellcont/shell/shellcont[0]/shell",
    "Office", "0000000003", "Collapse\\Office");

    // NodeName: Cross-Application Components
    // NodePath: 2\2
    SapGuiTreeExpandNode("usr/cntlIMAGE_CONTAINER/shellcont/shell/shellcont[0]/shell",
    "Cross-Application Components", "0000000020", "Expand\\Cross-Application Components");

    // NodeName: ALE Distribution Units
    // NodePath: 2\2\1
    SapGuiTreeExpandNode("usr/cntlIMAGE_CONTAINER/shellcont/shell/shellcont[0]/shell",
    "ALE Distribution Units", "0000000021", "Expand\\ALE Distribution Units");

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

    // NodeName: UPS Cockpit
    // NodePath: 2\2\1\1
    ThinkTime(3.1);
    SapGuiTreeSelectNode("usr/cntlIMAGE_CONTAINER/shellcont/shell/shellcont[0]/shell",
    "UPS Cockpit", "0000000075", false, "SelNode\\UPS Cockpit");

    // NodeName: UPS Cockpit
    // NodePath: 2\2\1\1
    SapGuiTreeDblClickNode("usr/cntlIMAGE_CONTAINER/shellcont/shell/shellcont[0]/shell",
    "UPS Cockpit", "0000000075", "DblClNode\\UPS Cockpit");

    // ALE - Distribution - Cockpit
    ThinkTime(3.6);
    SapGuiSetActiveWindow("wnd[0]", "ALE - Distribution - Cockpit", SAPGUI_MATCH_Exact);
  end TMain;