Share this page

# sapgui_get_text

Verification and Data Retrieval Functions

Retrieves text of a control.

    int sapgui_get_text( const char *description, const char *controlID, const char *outParamName, [args,] LAST );

description | User entered text to aid in understanding script
controlID | Object ID Strings
outParamName | Parameter to store the retrieved text
args | Optional Arguments
LAST | A marker indicating the end of the argument list. Not required if Optional Arguments are used.

The sapgui_get_text data retrieval function gets the text property of any visual screen object into the parameter outParamName.

For text boxes and menu items, sapgui_get_text retrieves the visible text. For toolbar buttons, the text is an empty string. For shells, the text is the class ID. Refer to the SAP documentation for more information about the text property of various controls.

## 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 following example uses sapgui_get_text to retrieve the text written to a text box.

Copy code

    // Enter the text "Escort"
    sapgui_set_text("",
            "Escort",
            "usr/txtF2",
            BEGIN_OPTIONAL,
                "AdditionalInfo=sapgui1025",
            END_OPTIONAL);
    // Retrieve the text
    sapgui_get_text("Read back the entry",
            "usr/txtF2", // Control ID
            "TextReadBack",
            LAST );
    // Output is "Escort"
    lr_output_message("%s", lr_eval_string("{TextReadBack}"));

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: