Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Function Group

Former Member
0 Likes
774

Hi All,

I need the Simple definition about the function modules and uses with examples.

thanks in advance.

1 ACCEPTED SOLUTION
5 REPLIES 5
Read only

Former Member
0 Likes
740

Hi,

Check this definition from the help.

Function modules are procedures that are defined in function groups (special ABAP programs with type F) and can be called from any ABAP program.

Function groups act as containers for function modules that logically belong together.

Function modules allow you to encapsulate and reuse global functions in the R/3 System.

Unlike subroutines, you do not define function modules in the source code of your program. Instead, you use the Function Builder.

Thanks,

Naren

Read only

Former Member
0 Likes
740

Hi vijay,

Function modules are ABAP routines that are administered in a central function library. They apply across applications and are available throughout the system. You must assign function modules to a function pool that is called a function group. A function group is nothing but a container for the function modules. Now create a function group and then a function module, which you can use for the next exercise steps.

Create a Function Group:


1. To open the Object Navigator choose from the SAP Menu Overview ® Object Navigator.
2. From the Object Selection window select Function group, enter
3. FG_Tutorial as name of your function group, and choose Display. Since the function group
4. FG_Tutorial does not yet exist, the system asks you whether to create it. Confirm with Yes. Enter a short description and choose Save.
5. In the window Create Object Catalog Entry choose Local object.
You created a local function group. Before it can receive function modules, you must activate it.
6. In the object list, use the right mouse button to select the function group
7. FG_Tutorial you just created and choose Activate. On the next screen choose Continue.
The function group is now active.

Create Global Data:

Within the function group you can declare global data. All function modules of this function group share this global data.

1. In the Object Selection window open the directory tree Includes and double-click on LFG_TutorialTOP.

2. Choose Create « Change (

STRG+F1 ) and enter the following data declarations in the tool area:

TABLES spfli.

DATA spfli_workarea LIKE spfli.

3. Check (

STRGF2 ) and activate ( STRGF3 ) the include file.

Create a Function Module:

Create a function module that reads data from table SPFLI .

1. If you are not yet in the Object Navigator, choose from the SAP Menu Overview à Object Navigator and display the function group

2. FG_Tutorial . In the Object selection window, use the right mouse button to select function group

3. FG_Tutorial , and choose Create à Function module. Enter as function module name

4. XX_RFC_READ_SPFLI and replace XX with the initials of your name. Enter a short description and choose Save.

The system lists the function module in the object list in a new directory Function modules, and displays it on the right side in the Function Builder.

5. Select the Attributes tab and under Processing type choose Remote-enabled module.

6. Select the Import tab and enter in the appropriate columns the names of the import parameters:

7. carrid with reference type like spfli-carrid and connid with reference type like spfli-connid . For each parameter set the Pass value flag. Select the Export tab and enter in the appropriate columns the names of the export parameters:

8. ex_spfli with reference type like spfli and sys with reference type like sy-sysid . For each parameter set the Pass value flag. Select the Exceptions tab and enter the exception

9. invalid_data . Select the Source code tab.

The system copies the entries you made in the other tabs and creates a source text.

10. Complete the function module with the actual flight data retrieval.

Compare your function with the model solution.

11. Save the function module (

12. STRG+S ). When the note on remote-enabled function modules appears, choose Continue. Check the function for errors (

STRGF2 ) and then activate it ( STRGF3 ).

Test the Function Module:


1. Choose Test/Execute (
2. F8 ) or Function module à Test à Test function module. As import parameter for CARRID enter
3. LH ; for CONNID enter 400 . Leave the RFC target system line empty. Choose Execute (
F8 ).
The system displays the export parameters EX_SPFLI and SYS in an additional table.
4. For a detailed display of the data select the value in line EX_SPFLI.

To call a FM in program

CALL FUNCTION 'function module name'.

Read only

Former Member
0 Likes
740

Have a look at below links:

<a href="http://help.sap.com/saphelp_nw2004s/helpdata/en/9f/db988735c111d1829f0000e829fbfe/frameset.htm">Function Modules</a>

<a href="http://www.erpgenie.com/abap/functions.htm">List of Function modules</a>

I hope it helps.

Best Regards,

Vibha

*Please mark all the helpful answers

Read only

Former Member
0 Likes
740

Hi,

Function modules are procedures that are defined in function groups (special ABAP programs with type F) and can be called from any ABAP program. 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 groups are containers for function modules.

Just have a look at these links:

<a href="http://help.sap.com/saphelp_nw04/helpdata/en/9f/db988735c111d1829f0000e829fbfe/frameset.htm">http://help.sap.com/saphelp_nw04/helpdata/en/9f/db988735c111d1829f0000e829fbfe/frameset.htm</a>

Creating Function Modules:

<a href="http://help.sap.com/saphelp_nw04/helpdata/en/9f/db988735c111d1829f0000e829fbfe/frameset.htm">http://help.sap.com/saphelp_nw04/helpdata/en/9f/db988735c111d1829f0000e829fbfe/frameset.htm</a>

Calling Function modules:

<a href="http://help.sap.com/saphelp_nw04/helpdata/en/db/9987bfc3cf11d194ad00a0c94260a5/frameset.htm">http://help.sap.com/saphelp_nw04/helpdata/en/db/9987bfc3cf11d194ad00a0c94260a5/frameset.htm</a>

Some Function Modules:

<a href="http://www.erpgenie.com/abap/functions.htm">http://www.erpgenie.com/abap/functions.htm</a>

Regards,

Gunasree.