0% found this document useful (0 votes)
39 views20 pages

5 - Modularization Techniques

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
39 views20 pages

5 - Modularization Techniques

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 20

Modularization Techniques

1
Modularization Techniques

▪ Modularization is a technique used to divide the application program into smaller units.

▪ This helps to maintain the code in an easy manner and reduce the code redundancy.

▪ The various modularization techniques are as follows :

 Include Programs/Includes

 Function Modules

 Subroutines

 Class-Methods
2
Include Programs/Includes

▪ Include program is a modularization technique. We use include programs to organize a

program code in to smaller units.

▪ We can create include programs with the help of SE38( ABAP Editor).

▪ The type of include programs is ‘I’.

▪ We can not execute a include program.

▪ The most important use of include programs is for lengthy data declarations used in

different programs.
3
Include Programs/Includes

▪ The syntax to use a Include program in to another type of programs is - INCLUDE

<include program name>. Example - include program name is ZDATA. The syntax to

reuse include program ZDATA in to another types of programs is INCLUDE ZDATA.

4
Function Modules

▪ It is a modularization technique.

▪ The transaction code to create a function module is SE37.

▪ To create a function module, we need to create a function group.

5
Function Group

▪ Function group is a container for the function modules.

▪ The transaction code to create a function group is SE80.

▪ A function group can store up to 99 function modules.

6
Tabs of Function Modules

▪ The various tabs of function module are as follows :

 Attributes - It provides the generic information about the function module like - date,

username, function group name, package name etc.

 Import - Input parameters of the function module.

 Export - Output parameters of the function module.

 Changing - Changing can acts as both input or output parameters.

 Tables - is for internal tables.


7
Tabs of Function Modules(Contd.)

 Exceptions - This tab is used to raise the exception/error.

 Source code - The purpose of this tab is to write the logic.

8
Calling of Function Modules

▪ We can call the function module in a program through the pattern button.

▪ Click on the pattern button and pass the function module name by choosing

call function radio button.


Pattern button in ABAP Editor

9
Subroutines

▪ Subroutine is also a modularization technique.

▪ A subroutine is a modularization unit with in the program itself.

▪ There is no separate transaction code to create a subroutine.

▪ A subroutine is a block of code introduced by FORM and ends with ENDFORM.

1
0
Types of Subroutines

▪ Subroutines are of 2 types.

1. Internal Subroutines - Subroutines which are defined and used in a same

program are called as Internal subroutines.

2. External Subroutines - Subroutines which are created in one program and used in

another program are called as external subroutines.

1
1
Syntax for Calling of Subroutine - Without Parameters

▪ Syntax - PERFORM < perform name>.

▪ In the example PERFORM = keyword ,

add = name of the subroutine,

the logic for the subroutine add is written

between FORM add and ENDFORM.

1
2
Syntax for Calling of Subroutine - With Parameters

▪ PERFORM <perform name> TABLES <tables parameters> USING <using parameters>

CHANGING <changing parameters>.

▪ We cannot change the sequence of tables using changing , but if any of them

(tables/using/changing) is not required, we can skip it.

1
3
Syntax for Calling of Subroutine - With Parameters(Contd.)

▪ In the example PERFORM, USING and

CHANGING = keywords,

sum = name of the subroutine,

p_input1 and p_input2 = using parameters,

lv_output = changing parameter.

1
4
Subroutine - Actual Parameters and Formal Parameters

▪ Parameter names that appear on the PERFORM

statement are called actual parameters.

▪ Parameter names that appear on the FORM

statement are called formal parameters.

▪ In the example - p_input1 , p_input2 ,

lv_output = actual parameters,

pv_input1 , pv_input2 , pv_output = formal parameters.


1
5
Subroutine With Parameters - Important Points

▪ Perform and form statement must contain the same number of parameters. It means

the number of actual parameters must be same as that of formal parameters.

▪ The addition tables , using and changing can only occur once in a statement.

1
6
Subroutine - Pass by Value and Pass by Reference

▪ In pass by value , the value is copied from actual parameter to formal parameter, If we

change the value of formal parameter the value of actual parameter will not change

whereas in pass by reference, we pass the address of actual parameter to formal

parameter, any changes done to the formal parameter value will change the value of

actual parameter also.

▪ In pass by value, the formal parameters have the memory of their own whereas in pass

by reference, the formal parameters does not have the memory of their own.
1
7
Comparison of Include Programs With Function Module & Subroutine

▪ Include programs does not have an interface( there is no provision to pass input and

output parameters) whereas function module and subroutines has interface(there is a

provision to pass input and output parameters).

1
8
Function Modules and Subroutines Comparison

▪ There is a separate transaction code SE37 (workbench tool) to create a function module

whereas there is no separate workbench tool to create a subroutine.

▪ We can check the output of function module using F8(we can independently run a

function module to check the output) whereas we cannot run a subroutine

independently.

▪ We can raise a exception in function module using exception tab whereas in subroutines

there is no exception tab.


1
9
Thank You

2
0

You might also like