Modulation techniques(include, subrotines, function,macros)

When you modularize source code, you place a sequence of ABAP statements in a module. Then, instead of placing all of the statements in your main program
we use these techniques.



§    Macros (outdated)
§     include 
§     Subroutines
§     Function Modules

Macros :If you want to reuse the same set of statements more than once in a program, you can include them in a macro.


 include : Include programs allow you to use the same source code in different programs. should have no parameters and if lengthy data dictionary it is useful


Subroutines : Subroutines are procedures that you can define in any ABAP program and also call from any program. Subroutines are normally called internally, that is, they contain sections of code or algorithms that are used frequently locally.


Function Modules : Function Modules are general purpose ABAP/4 routines that anyone can use. any one can use from any where through out the system.


1. what is the difference between macros and subroutines ?
A)1.macro doesn't have any return statement.but a subroutine have
2.execution time needed for a macro is much lesser than
subroutine
3.memory requirement for a macro is generally heigher
4.subroutine can be classified as stated in Previous
answers..but no such classification is available with macro
although macro can have different types of nested form
5.generally no of instructions in macro are smaller than
subroutine
6.macro is always local to the program that defines it
subroutine may or may not be local.

2. what is the difference between subroutines & includes ?
A) includes doesn't have parameter interface.where subroutines have
 parameter interface.

3. where the function modules exist?
A) function modules are present in functional group.