Share this page

# sapgui_active_object_from_parent_method

Method and Property Functions

Selects an object within a parent object by calling the parent's method.

    int sapgui_active_object_from_parent_method( const char *control_id, const char *method_name, char *arg1, ..., char *argn, [optionArguments,] LAST );

control_id | Object ID Strings
method_name | The name of the SAP method to invoke
args | Arguments to the method
optionArguments | Optional Arguments
LAST | A marker indicating the end of the argument list. Not required if Optional Arguments are used.

The function sapgui_active_object_from_parent_method selects an object from within a larger parent object with an identification number control_id. The embedded object is returned by the method method_name.

For example, a row of a table has no specific control ID. However, you can access the row by passing both the ID of the table control (as control_id) and the SAP method (method_name) which returns a row within a table.

args are the arguments that are passed to the control's method.

After sapgui_active_object_from_parent_method, the object becomes the active object. Invocations of sapgui_call_method_of_active_object, sapgui_set_property_of_active_object, or sapgui_get_property_of_active_object will apply to that object.

## 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 with the method getAbsoluteRow, to activate the 5th row of the table. The row's "selected" property is then set to true using sapgui_set_property_of_active_object.

Copy code

    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");
        lr_think_time(4);
        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("Selected = {ParamName2}"));
        return 0;
    }

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: