SapGuiSetProperty Function

Action

This function is used to set any accessible property of an SapGui control. It can be used for all data types.

Include file

SapGui.bdh

Syntax

SapGuiSetProperty( in sControlId     : string allownull, 
                   in sPropertyName  : string, 
                   in sPropertyValue : number,
                   in sTimer         : string optional ) : boolean;
Parameter Description
sControlId The uniquely identifying id of a SapGui control.
sPropertyName The name of the property to be set.
sPropertyValue The value to be set for this property.
sTimer Name of the timer to be 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);

    // 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", "minisap", "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");

    // 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;