SapGuiSetCheckbox Function

Action

Checks or unchecks the specified SapGui check box.

Include file

SapGui.bdh

Syntax

SapGuiSetCheckbox( in sControlId : string allownull, 
                   in bChecked   : boolean,
                   in sTimer     : string optional ) : boolean;
Parameter Description
sControlId The uniquely identifying id of a check box control.
bChecked Specifies, whether to check or uncheck the check box
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(2.2);
    SapGuiLogon("ddic", "*******", "000", "");

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

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

    // Other menu
    SapGuiIgnoreError(SAPENGINE_STATUSBAR_CHANGED, SEVERITY_SUCCESS);
    SapGuiPressButton("tbar[1]/btn[17]", " Other menu");
    // StatusBar(Msg/Id/Type/No): The search help for could not be initialized (CNTL error)/27051464/S/002

    // Wertebereich einschränken
    ThinkTime(8.5);
    SapGuiSetActiveWindow("wnd[1]", "Wertebereich einschränken", SAPGUI_MATCH_Exact);
    SapGuiSetFocus("usr/tabsG_SELONETABSTRIP/tabpTAB002/ssubSUBSCR_PRESEL:SAPLSDH4:0220/chkG_SELPOP_STATE-BUTTON");
    SapGuiSetCheckbox("usr/tabsG_SELONETABSTRIP/tabpTAB002/ssubSUBSCR_PRESEL:SAPLSDH4:0220/chkG_SELPOP_STATE-BUTTON",
    true, "No restriction");
    ThinkTime(2.1);
    SapGuiPressButton("tbar[0]/btn[12]");
  end TMain;