Register Login

What are Subroutines and Types of Subroutines?

Updated May 18, 2018

Subroutines are program modules which can be called from other ABAP/4 programs or within the same program.

Are introduced with form statement & ended with endform statement. you call subroutines from abap program using the perform statements. you can define subroutines in any abap program . you can either call a subroutine that is part of the same program or an external subroutine that is one that belongs to a different program.

Types of Subroutines

A. Internal Subroutines: The source code of the internal subroutines will be in the same ABAP/4 program as the calling procedure (internal call).

B. External Subroutines: The source code of the external subroutines will be in an ABAP/4 program other than the calling procedure.

 


Comments

  • 06 Sep 2010 6:08 am abhishek Helpful Answer
    internal subroutine example

    SUBROUTINE calc
    PRINT*,"Enter number one"
    READ*,a
    PRINT*,"Enter number two"
    READ*,b
    c=SQRT(a**2+b**2)
    END SUBROUTINE calc


    external subroutine example

    ...
    PERFORM SUBR02
    PERFORM SUBR03
    ...
    DEFINE SUBROUTINE SUBR02

    END-SUBROUTINE
    ...
    DEFINE SUBROUTINE SUBR03
    END-SUBROUTINE
    END-SUBROUTINE

×