Subroutines are procedures. That we can define in any ABAP program & calling from the same or some other ABAP program. Procedure is the collection of statements.

Note: - In subroutine calling is the first & definition is the next. In subroutines all the using parameters are called input parameters. All the changing parameters are called as output parameters.
We can’t place the any executable statement after the definition of the subroutine.

  •  Perform the addition of two numbers by using subroutines.

Data type I.
ParameterP_input1 type IP_input2 type I.
Perform add1 using P_input1 P_input2 changing R.
Write R.
Form add1 using type I type I changing C type I.
A + B.

There are two types of subroutines.
      1.Internal subroutines.
      2.External subroutines.

Internal subroutines: -

It’s nothing but the definition of the subroutine as well as calling of the subroutine must be in the same program.

External subroutine: -

It’s nothing but the definition of the subroutines taken from one program & the calling of the subroutine is is taken from some other ABAP program.

Syntax of calling the external subroutine: -
Perform <form name> in program <program name> using <IP 1> <IP 2> ----
                                                                                     changing <OP1> <OP2> ---