Professional Documents
Culture Documents
Function modules are procedures that are defined in special ABAP programs only, so-called function groups, but can be called from all ABAP programs. Function groups act as containers for function modules that logically belong together. You create function groups and function modules in the ABAP Workbench using the Function Builder. Function modules allow you to encapsulate and reuse global functions in the SAP System. They are managed in a central function library. The SAP System contains several predefined functions modules that can be called from any ABAP program. Function modules also play an important role during updating and in interaction between different SAP systems, or between SAP systems and remote systems through remote communications. Unlike subroutines, you do not define function modules in the source code of your program. Instead, you use the Function Builder. The actual ABAP interface definition remains hidden from the programmer. You can define the input parameters of a function module as optional. You can also assign default values to them. Function modules also support exception handling. This allows you to catch certain errors while the function module is running. You can test function modules without having to include them in a program using the Function Builder. The Function Builder also has a release process for function modules. This ensures that incompatible changes cannot be made to any function modules that have already been released. This applies particularly to the interface. Programs that use a released function module will not cease to work if the function module is changed.
All ABAP programs are modular in structure and made up of processing blocks you can modularize source code by placing ABAP statements either global include programs or function modules. The processing blocks that you call from ABAP programs are called procedures. Modularization makes ABAP programs easier to read and maintain, as well as avoiding redundancy, increasing the reusability of source code, and encapsulating data. Function modules are procedures that are defined in function groups (type F) and can be called from any ABAP program. Every function module needs a function group which acts as containers. Function modules allow you to encapsulate and reuse global functions in the R/3 System. Function modules are stored in a central library. The R/3 System contains a wide range of predefined function modules that you can call from any ABAP program. Function modules play an important role in updating the databases. Function modules play an important role in remote communications between R/3 Systems or between an R/3 System and a non-SAP system. Function modules also support exception handling. This allows you to catch certain errors while the function module is running. The actual ABAP interface definition remains hidden from the programmer. You can define the following Function modules can be tested without having to include them in a program. Please follow the steps to create the function groups and function modules in the ABAP by using function builder. GOTO> Tcode: SE37 or Tools -> ABAP workbench -> Development -> Function builder.
Step 1: Create function group first if your not using existing one Function builder -> Goto -> function groups -> Create function groups. Step 2: Create function module using the function builder. Calling function module: To call the function module, try creating a report and calling the function modules. Follow the steps as below: 1) Create ABAP Program using ABAP editor ( TCODE: SE38). 2) Define the required Variables. 3) Call function module, by passing the values.