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.


<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.


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.



       1.      In the command editor, enter FUN ( <function module>, <command interface> ).

       2.      Double-click <command interface>.

The command interface appears in the structure editor.

       3.      In the structure editor, enter the appropriate values in the fields. These values can be parameters or fixed values.


You can parameterize interface parameters typed to a data dictionary object or a primitive ABAP type. Interface parameters typed to an ABAP type pool component cannot be parameterized or supplied with fixed values. You can test function modules containing the later sort of interface parameter if you avoid using those particular parameters.

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.