sapgui_call_method_of_active_object_ex
| Method and Property Functions |
Invokes a method of the active object and saves the return value to a parameter.
int sapgui_call_method_of_active_object_ex( const char *method_name, const char *outputParamName, char *arg1, ... char *argn, [optionalArguments,] LAST );
| method_name | The name of the SAP method to invoke |
| outputParamName | The parameter in which to store the return value of the call. |
| 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 function sapgui_call_method_of_active_object_ex invokes the method method_name of the current active object selected by sapgui_active_object_from_parent_method or sapgui_active_object_from_parent_property. The return value of the invoked method is stored in parameter outputParamName.
The return value can be a simple value or a GuiCollection Array.
args are the arguments that are passed to the control's method. See SAP documentation for discussion of object methods and their arguments.
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
In this example, the first child of a TreeView root has two sub children, "Item1" and "Item2". sapgui_call_method_of_active_object_ex saves the node names to parameters.
// Save the collection object as the active object
sapgui_active_object_from_parent_method(shell2,
"GetSubNodesCol", "Child1", LAST );
// Call the "ElementAt" method of the collection on each item:
sapgui_call_method_of_active_object_ex( "ElementAt",
"MySubNode_1", "0", LAST );
sapgui_call_method_of_active_object_ex( "ElementAt",
"MySubNode_2", "1", LAST );

