
Use
FUN ( <function module>, <command interface> ).
FUN ( <function module>, <command interface> , <target system> ).
The FUN command executes a function module. See Testing Function Modules.
Command Interface
The values for EXPORTING, IMPORTING, TABLES, CHANGING, and EXCEPTIONS are passed by means of the command interface.
As well as assigning parameter values using the structure editor, you can also address the function interface programmatically in the command editor. This is useful if, for example, you want to assign values dynamically. In contrast, you cannot address the exceptions programmatically.
Allowed:
<command interface>-IMPORTING-<field name>
<command interface>-IMPORTING-<structure>-<field name>
<command interface>-TABLES-<table>[<index>]-<field name>
Not allowed:
<command interface>-Exception.-<exception>
Exception Handling
If a function module raises an exception, the name of the exception is logged in the command interface. It is also assigned to the eCATT standard variable &EXCEPTION.
Normally, a function module raising an exception is marked in the log as having an error. To prevent this, enter ' X' in the exception's Value field.
Tables
To edit a table in a command interface, double-click the table name in the tree in the structure editor. The editor for the table opens up beside the tree. Here, you can add or remove rows, and maintain field values.
You do not need to know the number of rows a table will return. The appropriate number of rows will be generated during execution and all will be visible in the log.
Procedure
In the command editor, enter FUN ( <function module>, <command interface> ).
Double-click <command interface>.
The command interface appears in the structure editor.
In the structure editor, enter the appropriate values in the fields. These values can be parameters or fixed values.
Notes
You cannot test function modules with type-pool-based parameters directly with the FUN command. In this case, the function module must be called with the relevant declaration in inline ABAP or rewritten in an interface with the correct DDIC references.
UI-oriented value conversions (such as conversion exits) or value formatting, are not performed in the FUN interface.
If, after evaluation of the command interface, a TABLES parameter results in a single table line in which every field of the table structure is initial according to its type, a table with no line is supplied to the function module.