Share this page

# sapgui_set_text

General Object Functions

Enters text in a control.

    int sapgui_set_text( const char *description, const char *text, const char *controlID, [args,] LAST );

description | User entered text to aid in understanding script
text | Either the literal text to be written to the control, or a text file to be copied into the control
controlID | Object ID Strings
args | Optional Arguments
LAST | A marker indicating the end of the argument list. Not required if Optional Arguments are used.

sapgui_set_text writes the value of the text argument to the control. If text is the literal text, place it in quotation marks:`"The text to enter"`. If text is a file, the syntax is "`file`=filename.ext". The quotation marks are part of the syntax. The file must be in the script folder. You cannot use a path.

The "file=filename.ext" syntax is recorded when pasting a large amount of text unto the control. A file is created containing the pasted text, and the file is used instead of the clipboard when the test is run. The file can be edited. The file name can be parameterized, so different Vusers can use different files.

Note: When a file is passed as the text argument, control characters at the end of the file are also inserted in the control.

## Return Values

This function returns LR_PASS (0) on success or LR_FAIL (1) on failure.

## Parameterization

You can parameterize all string (char type) arguments.

## Example

The first example uses sapgui_set_text to enter the user name on the logon window. To record this step during logon as shown in the example, show operations on logon windows To record detail steps during logon clear Hide operations on logon windows: Choose Tools > Recording Options > SAPGUI > Code generation.

Copy code

    sapgui_set_text("User",
        "MyUserName",
        "usr/txtRSYST-BNAME",
        BEGIN_OPTIONAL,
            "AdditionalInfo=sapgui1004",
        END_OPTIONAL);
    The second example shows the use of sapgui_set_text to emulate dropping a file in a text edit control.
    sapgui_set_text("",
        "file=s201801.arg",
        "usr/cntlSRC/shellcont/shell",
        LAST );

Tips to improve your search results... VuGen Function Reference Version 26.1-26.3 Function Reference 26.1-26.3 All View Local Help Center View Online Help Center Version: