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 existing function module, the system checks if the type of an IMPORTING, EXPORTING, or CHANGING parameter has been declared in the back end. If this is not the case, the editor automatically assigns the addition TYPE ANY to the parameter. For table parameters without a type, the editor adds the addition TYPE STANDARD TABLE.

For both untyped parameters, the ##ADT_PARAMETER_UNTYPED pragma is added to the definition.

When you save, the parameter is kept untyped and unchanged in the back end; that is, the system does not explicitly add TYPE ANY or TYPE STANDARD in transaction SE37.

Note Global, untyped parameters are supported with SAP NetWeaver 7.5 SP00. So, SAP Note 2054349Information published on SAP site is obsolete in these releases.
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 a type and will be changed to 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 in 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, since the source code is rebuilt from the persisted components in the back end, the pretty printer will convert the definition part into upper case letters.