sapgui_get_property_of_active_object

Method and Property Functions

Retrieves a property of the active object.

int sapgui_get_property_of_active_object( const char *property_name, const char *output_param_name, [args,] LAST );
property_nameThe name of the SAP GUI Object Properties to retrieve
output_param_name The VuGen parameter containing the property of the object
argsOptional Arguments
LAST A marker indicating the end of the argument list. Not required if Optional Arguments are used.

The sapgui_get_property_of_active_object data retrieval function retrieves the value of the specified property property_name from the current active object. The value is saved in output_param_name.

The current object is selected with sapgui_active_object_from_parent_method or sapgui_active_object_from_parent_property.

Note that if the property is a set of strings, output_param_name contains the parameter in the form string1,string2,...,stringn.

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_active_object_from_parent_method to select the 5th row within a table. The row's selected property is then set to true using sapgui_set_property_of_active_object. sapgui_get_property_of_active_object then verifies the value of the selected property.

Action() {
    // Connect to R/3 server, and log on
    sapgui_open_connection("My Connection", "con[0]");
    sapgui_select_active_session("ses[0]");
    sapgui_logon("MyUserName", "MyPassword", "800", "EN", LAST );
    sapgui_select_active_window("wnd[0]");
    // Selecting 5-th row on "Basic personal data" tab
    sapgui_set_property(
        "shellcont/shell/shellcont[0]/shell/shellcont[1]/shell[1]",
        "HierarchyHeaderWidth", "251", LAST );
    sapgui_active_object_from_parent_method(
	"usr/tabsMENU_TABSTRIP/tabpTAB01/ssubSUBSCR_MENU:SAPMP50A:0400/subSUBSCR_ITMENU:SAPMP50A:0310/tblSAPM/P50ATC_MENU",
	 "getAbsoluteRow", "5", LAST );
	 sapgui_set_property_of_active_object("selected", "True",
        LAST );
    // Now verify the set property
    sapgui_get_property_of_active_object("selected", 
        "ParamName2", LAST );
    lr_output_message(lr_eval_string("Status bar text = {ParamName2}"), LAST );
    return 0;
}