SapGuiGetProperty Function

Action

This function is used to retrieve any accessible property of a SapGui control.

Include file

SapGui.bdh

Syntax

SapGuiGetProperty( in  sControlId     : string allownull, 
                   in  sPropertyName  : string, 
                   out sPropertyValue : string optional,
                   in  nSize          : number sizespec optional ) : boolean;
Parameter Description
sControlId The uniquely identifying id of a SapGui control
sPropertyName The name of the property to be set.
sPropertyValue The buffer to be assigned the value
nSize The size of the buffer

Return value

  • true if successful

  • false otherwise

Example

transaction TMain
  var
    buffer : string;
    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);

    // maximize
    // wnd[0]
    SapGuiInvokeMethod("wnd[0]", "maximize");

    // Logon to SAP System
    // Before running a test you have to customize the password parameter!
    ThinkTime(2.7);
    SapGuiLogon("ddic", "*******", "000", "");

    // Copyright
    ThinkTime(2.2);
    SapGuiSetActiveWindow("wnd[1]", "Copyright", SAPGUI_MATCH_Exact);

    // press
    // btn[0]
    SapGuiInvokeMethod("tbar[0]/btn[0]", "press");

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

    // expandNode
    // shell
    SapGuiSetString("0000000003");
    SapGuiInvokeMethod("usr/cntlIMAGE_CONTAINER/shellcont/shell/shellcont[0]/shell", "expandNode");

    // selectedNode
    SapGuiSetProperty("usr/cntlIMAGE_CONTAINER/shellcont/shell/shellcont[0]/shell", "selectedNode", "0000000004"); 
    // topNode
    SapGuiSetProperty("usr/cntlIMAGE_CONTAINER/shellcont/shell/shellcont[0]/shell", "topNode", "Favo");

    SapGuiGetProperty("usr/cntlIMAGE_CONTAINER/shellcont/shell/shellcont[0]/shell", "topNode", buffer);

    // doubleClickNode
    // shell
    SapGuiSetString("0000000004");
    SapGuiInvokeMethod("usr/cntlIMAGE_CONTAINER/shellcont/shell/shellcont[0]/shell", "doubleClickNode");

    // press
    // btn[15]
    ThinkTime(6.0);
    SapGuiInvokeMethod("tbar[0]/btn[15]", "press");

    // press
    // btn[15]
    SapGuiInvokeMethod("tbar[0]/btn[15]", "press");

    // Log Off
    SapGuiSetActiveWindow("wnd[1]", "Log Off", SAPGUI_MATCH_Exact);

    // press
    // SPOP-OPTION1
    SapGuiInvokeMethod("usr/btnSPOP-OPTION1", "press");
  end TMain;