Example 

The following example shows the object-oriented aspect of function groups in the simple case of a counter.

Suppose we have a function group called COUNTER:

FUNCTION-POOL COUNTER.

DATA COUNT TYPE I.

FUNCTION SET_COUNTER.
* Local Interface IMPORTING VALUE(SET_VALUE)
  COUNT = SET_VALUE.
ENDFUNCTION.

FUNCTION INCREMENT_COUNTER.
  ADD 1 TO COUNT.
ENDFUNCTION.

FUNCTION GET_COUNTER.
* Local Interface: EXPORTING VALUE(GET_VALUE)
  GET_VALUE = COUNT.
ENDFUNCTION.

The function group has a global integer field COUNT, and three function modules, SET_COUNTER, INCREMENT_COUNTER, and GET_COUNTER, that work with the field. Two of the function modules have input and output parameters. These form the data interface of the function group.

Any ABAP program can then work with this function group. For example:

DATA NUMBER TYPE I VALUE 5.

CALL FUNCTION 'SET_COUNTER' EXPORTING SET_VALUE = NUMBER.

DO 3 TIMES.
  CALL FUNCTION 'INCREMENT_COUNTER'.
ENDDO.

CALL FUNCTION 'GET_COUNTER' IMPORTING GET_VALUE = NUMBER.

After this section of the program has been processed, the program variable NUMBER will have the value 8.

The program itself cannot access the COUNT field in the function group. Operations on this field are fully encapsulated in the function module. The program can only communicate with the function group by calling its function modules.