Share this page

# sapgui_call_method

Method and Property Functions

Invokes a method of a SAP object.

    int sapgui_call_method( const char *control_id, const char *method_name, void *arg1, ..., void *argn, [optionalArguments] LAST);

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

The sapgui_call_method function identifies the SAP object with the SAP identifier control_id, and calls the object's method method_name. It passes to the method the actual arguments arg1...argn.

In some cases, VuGen generates an additional argument, AdditionalInfo.

## 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_call_method to invoke the method sendVKey which, when passed with a "0" argument, emulates an ENTER-key press.

sapgui_call_method is then invoked to make various calls to the SAP column tree control called shellcont/shell.

Copy code

    Action() {
    // Load the sample program
        sapgui_set_ok_code("/ndwdm", LAST );
        sapgui_select_active_window("wnd[0]");
        // Press the "ENTER" key
        sapgui_call_method("wnd[0]", "sendVKey", "0", LAST );
        // Select the "SAP column tree" node
        sapgui_call_method("shellcont/shell",
            "SelectItem", "000712", "REPTITLE",
            LAST );
        sapgui_call_method("shellcont/shell",
            "EnsureVisibleHorizontalItem",
            "000712", "REPTITLE", LAST );
        sapgui_call_method("shellcont/shell",
            "DoubleClickItem", "000712",
            "REPTITLE", LAST );
        ...
        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: