ABAP Keyword Documentation →  ABAP − Reference →  Calling and leaving program units →  Calling Processing Blocks →  Calling Procedures →  CALL FUNCTION → 

CALL FUNCTION - parameter_tables

Short Reference

Syntax

... [PARAMETER-TABLE ptab]
    [EXCEPTION-TABLE etab]... .

Extras:

1. ... PARAMETER-TABLE ptab ...

2. ... EXCEPTION-TABLE etab ...

Effect

These additions use the special internal tables ptab and etab to assign actual parameters to the formal parameters of the function module and return values to the non-class-based exceptions.

Addition 1

... PARAMETER-TABLE ptab ...

Effect

PARAMETER-TABLE can be used to assign actual parameters to all formal parameters of the called function module. ptab expects a sorted table of table type ABAP_FUNC_PARMBIND_TAB or of row type ABAP_FUNC_PARMBIND from the type group ABAP. When the statement CALL FUNCTION is executed, the table must contain exactly one row for each non-optional formal parameter; this row is optional for each optional formal parameter. The table columns are:

- ABAP_FUNC_EXPORTING for input parameters
- ABAP_FUNC_IMPORTING for output parameters
- ABAP_FUNC_TABLES for table parameters
- ABAP_FUNC_CHANGING for input/output parameters

If the category specified from the caller perspective does not match the actual category of the formal parameter, a handleable exception is raised.

The columns NAME and KIND form the unique key of the table ptab.

Addition 2

... EXCEPTION-TABLE etab ...

Effect

EXCEPTION-TABLE can be used to assign return values to exceptions of the called function module that are not marked as exception classes in Function Builder. etab expects a hashed table of table type ABAP_FUNC_EXCPBIND_TAB or of row type ABAP_FUNC_EXCPBIND from the type group ABAP. The table can contain exactly one row for each non-class-based exception of the function module when the statement CALL FUNCTION is executed. The table columns are:

The column NAME is the unique key of table etab.

Example

Calls the function module GUI_DOWNLOAD with dynamic pass by parameter The name of the function module is specified in the string func and the interface is supplied with data using the internal tables ptab and etab.

DATA: line     TYPE c LENGTH 80,
      text_tab LIKE STANDARD TABLE OF line,
      filename TYPE string,
      filetype TYPE c LENGTH 10,
      fleng    TYPE i.

DATA: func TYPE string,
      ptab TYPE abap_func_parmbind_tab,
      etab TYPE abap_func_excpbind_tab.

func = 'GUI_DOWNLOAD'.
filename = 'c:\temp\text.txt'.
filetype = 'ASC'.

ptab = VALUE #( ( name  = 'FILENAME'
                  kind  = abap_func_exporting
                  value = REF #( filename ) )
                ( name  = 'FILETYPE'
                  kind  = abap_func_exporting
                  value = REF #( filetype ) )
                ( name  = 'DATA_TAB'
                  kind  = abap_func_tables
                  value = REF #( text_tab ) )
                ( name  = 'FILELENGTH'
                  kind  = abap_func_importing
                  value = REF #( fleng ) ) ).

etab = VALUE #( ( name = 'OTHERS' value = 10 ) ).

CALL FUNCTION func
  PARAMETER-TABLE ptab
  EXCEPTION-TABLE etab.

CASE sy-subrc.
  WHEN 1.
    ...
    ...
ENDCASE.