Subroutines in SAP ABAP

What are sub-routines in SAP ABAP ? Using sub-routines in SAP ABAP, differences between sub-routines and Function Modules

+ -

These are also sub programs, which contains set of re-usable statements for doing some specific task.
These are mainly used for re-usability within the same program, however, we can re-use these Subroutines in other programs too.
Subroutines contain importing and exporting parameters.

Function Modules V/S Subroutines

The main difference between Function Modules and Subroutines are sub-routines does not contain any exceptions and Subroutines are mainly used for local modularization where as function modules contains exceptions and used for global modularization.

sub-routines have definition and implementation parts.

Syntax:DEFINITION PART:
PERFORM <SUBROUTINE NAME> USING <V1> <V2>   "DOUBLE CLICK ON SUBROUTINE NAME TO CREATE 
                           CHANGING <CV1> <CV2>
                           TABLES <IT1> <IT2> .

**<V1> <V2> (VARIABLES), <CV1> <CV2> (CHANGING VARIABLES) AND <IT1> <IT2> (IMPORTING TABLES) ARE ACTUAL PARAMETERS

Syntax IMPLEMENTATION PART
FORM <SUBROUTINE NAME> USING <FV1> <FV2>
                       CHANGING <FCV1> <FCV2>
                       TABLES <FIT1> <FIT2>.
ENDFORM.
**<FV1> <FV2>, <FCV1> <FCV2> AND <FIT1> <FIT2> ARE FORMAL PARAMETERS

Learner Questions


No Questions by learners, be first one to ask ..!!

    Please Sign in to ask a question

    Was this lesson helpful to you? Yes No 46 People out of 53 think this lesson helpful


    Lesson Navigation

    ←Previous Chapter
    Next Chapter →