Mastering ABAP: A Step-by-Step Guide to Function Modules and Groups for Modularized Programming
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.
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.
Requirement :-
- let’s create a function module for sum of two numbers.
1. Creation of function group :-
-
Step 1 :- Go to SE80 transaction code → Object Navigator.
-
Step 2 :- From the drop down select function group.
-
Step 3 :- Give a name of function group.
-
Step 4 :- press enter.
-
Step 5 :- Click on yes a popup screen will appear.
-
Step 6 :- Give short description → press enter → Assign package and transaction request and press enter.
-
Step 7 :- Right click on function group and click on activate to activate the function group.
-
Step 8 :- You will see two includes, will be added after activation of function group.
- First one will be TOP
- Second one is UXX
- Note :- This XX will be replaced the number of function modules created in this function group.
2. Creation of Function Modules for Sum of Two Numbers :-
-
Step 1 :- Go to TCODE SE37(Function Builder).
-
Step 2 :- Give a name.
-
Step 3 :- Click on create button → a popup screen will appear.
-
Step 4 :- Provide function group and short description.
-
Step 5 :- Click on Save → Function Builder screen will appear.
-
Step 6 :- There are always 7 tabs in Function Builder :-
Tabs :-
-
Attributes :- Attribute is always the generic or general information of the function module like - date, username, function group name, package name etc.
-
Import :- Import parameters of the function module.
-
Export :- Output parameters of the function module.
-
Changing :- Changing can acts as both input or output parameters.
-
Tables :- It is for internal tables.
-
Exceptions :- This tab is used to raise the exception/error.
-
Source Code :- The purpose of this tab is to write the logic.
-
-
Step 7 :- In import tab, declare two input parameters.
-
Step 8 :- define a output parameters in Export tab.
-
Step 9 :- Go to source code and write the logic and activate the function module.
Execute the function module :-
-
Press F8.
-
Press F8.
- You can see the output here.
Comments
Post a Comment