SapGuiSetText Function

Action

Enters text into a SapGui text field.

Include file

SapGui.bdh

Syntax

SapGuiSetText( in sControlId : string allownull, 
               in sText      : string,
               in sTimer     : string optional ) : boolean;
Parameter Description
sControlId The uniquely identifying id of a text control.
sText Text to be entered into the textfield.
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);
    ThinkTime(2.8);
    SapGuiSetText("usr/txtRSYST-BNAME", "ddic");

    // Logon to SAP System
    // Before running a test you have to customize the password parameter!
    SapGuiSetText("usr/pwdRSYST-BCODE", "********");
    SapGuiSetFocus("usr/pwdRSYST-BCODE");

    // caretPosition
    SapGuiSetProperty("usr/pwdRSYST-BCODE", "caretPosition", "7");
    SapGuiIgnoreError(SAPENGINE_STATUSBAR_CHANGED, SEVERITY_SUCCESS);
    SapGuiSendVKey(SAPGUI_VKEY_ENTER);

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