Subroutines are obsolete. It might come to you as a surprise but it’s true. Every old school programmer loves them and understandably so. But their days are numbered and rightly so. The world writes in Object Oriented Programming and the benefits overweigh the pain. Big question is how?

Different approaches are there and every approach has few pro and few con points. Following is an outline of one approach which I prefer and is written with respect to a Function Module.

FM will have 3 parts –

Main Body of FM

DATA <object_name> TYPE REF TO <class_name> .

CREATE OBJECT <object_name> .

<object_name>-><method_name>(parameters) . “method call

TOP (include) in Function Group

CLASS <class_name> DEFINITION.

METHODS <method_name> IMPORTING <variable> <data_definition>

                                                    EXPORTING <variable> <data_definition>

                                                    CHANGING <variable> <data_definition> .


FORM (include) in Function Group


METHOD <method_name>



The Class Definition is written in TOP while Class Implementation is written in FORM. In this way, both definition and coding is out of the sight when one debugs the FM. When the method is called code goes to the implementation and processes accordingly. Same approach goes with Report programs as well.

In principle it is not very different from how Subroutines were being used. The biggest difference is that an object oriented method only modifies the attributes of the relevant instance.