Show TOC

Definition PartLocate this document in the navigation structure

The definition part declares the parameters of a function module. It starts with FUNCTION < func_name > and ends with a period after the last declaration.

Note You must define a type for each parameter. Otherwise the meaning is not clear.

When you open an already existing function module, the system will check if the type of an IMPORTING, EXPORTING,or CHANGING parameter has not been declared in the back end. In this case, the editor will automatically assign the addition TYPE ANY to the parameter. For table parameters without a type, the editor will add the addition TYPE STANDARD TABLE.

Example

The following example shows a definition part that starts with FUNCTION and ends after the last parameter declaration with a period. You can also see how TYPE ANY has been added to the exporting parameter EX_PARAM_3. The table parameter TAB_PARAM_2 was not assigned to a type and will be changed into TYPE STANDARD TABLE.

FUNCTION MY_FUNCTION_MODULE 
 IMPORTING 
  VALUE(IM_PARAM_1) TYPE STRING OPTIONAL 
  VALUE(IM_PARAM_2) TYPE I DEFAULT 42 
  IM_PARAM_3 TYPE STRING 
 EXPORTING 
  EX_PARAM_1 TYPE REF TO STRING 
  EX_PARAM_2 TYPE ANY 
  VALUE(EX_PARAM_3) TYPE ANY 
  VALUE(EX_PARAM_4) TYPE ANY 
 CHANGING 
  CH_PARAM_1 TYPE STRING 
  VALUE(CH_PARAM_2) LIKE TADIR 
 TABLES 
  TAB_PARAM_1 LIKE TAB LINE 
  TAB_PARAM_2 TYPE STANDARD TABLE 
 EXCEPTIONS 
  EXCEPTIONS_1. 
Limitations

The ADT source code-based view of a function module is not persisted on the database in the back end. This leads to the following limitations:

  • You cannot add or save any comments in the definition part. They will be lost after activation.
  • After activation, the pretty printer will convert the definition part into upper case letters. Because, the source code gets rebuilt from the persisted components in the back end.