Modularization Techniques: Function Module
Function Module:
- The function modules are global modularizations objects.
- The functions modules can be called anywhere in the same system and in another system also.
- The T-code ‘SE37’ is used to work with the functional modules.
- The functional modules should be assigned to a function group.
Function group: it is a collection of function modules.
Steps to create Function module:
- Goto T-code 'SE37'.
- Enter FM name and click on 'create'.
- Enter input parameters in 'Import' Tab.
- Enter Output parameters in Export tab.
- Enter Exceptions in Exceptions Tab.
- Write the below code in 'Source code' tab.
Calling Function Module through Program
REPORT ZVB_ADDITION.
TABLES:VBAP.
PARAMETERS:P_A TYPE I,
P_B TYPE I.
DATA:lv_C TYPE I.
CALL FUNCTION 'ZVB_DIV'
EXPORTING
v_a = p_a
v_b = p_b
IMPORTING
V_C = lv_c
EXCEPTIONS
NOT_ZERO = 1
OTHERS = 2
.
IF sy-subrc <> 0.
MESSAGE 'Input can not be zero' TYPE 'E'.
ELSE.
WRITE lv_c.
ENDIF.
Comments
Post a Comment