SAP GUI Functions (SAPGUI) > Alphabetical List of Functions > sapgui_set_text


Example: 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.


You can parameterize all string (char type) arguments.