Skip to Content
author's profile photo Former Member
Former Member

What is function group?

What is function group? what is the purpose of it while creating function module .

thanks .

Edited by: Alvaro Tejada Galindo on Mar 4, 2008 3:14 PM

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

7 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Mar 04, 2008 at 09:40 AM

    Hi,

    FUNCTION GROUP:

    -


    It is a container of user-defined function modules. Function modules created should be specified a function group, where it can be accessed globally then.

    To create a function group, use following navigations:

    SE80 -> Select Function Group from drop-down list box -> Specify function group name starting with Z or Y -> Press Enter -> Click on Yes to create object -> Enter short description -> Save under a package -> Assign a request number -> A function group is created in a function library.

    Regards,

    Priya.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Mar 04, 2008 at 09:40 AM

    Hi,

    check out this link..

    http://help.sap.com/saphelp_nw70/helpdata/en/9f/db988735c111d1829f0000e829fbfe/content.htm

    FUNCTION MODULES:

    -


    • It is a modularization technique.

    • It can be called from any different clients.

    • It can return a value.

    FUNCTION GROUP:

    -


    It is a container of user-defined function modules. Function modules created should be specified a function group, where it can be accessed globally then.

    To create a function group, use following navigations:

    SE80 -> Select Function Group from drop-down list box -> Specify function group name starting with Z or Y -> Press Enter -> Click on Yes to create object -> Enter short description -> Save under a package -> Assign a request number -> A function group is created in a function library.

    TYPES OF FUNCTION MODULES:

    -


    1. NORMAL FUNCTION MODULE - It can be called only from within the same client.

    2. REMOTE-ENABLED FUNCTION MODULE - It can be called either from within the same client or different client.

    Navigations to create a function module:

    -


    SE37 -> Opens Function Builder Screen -> Specify function module name starting with Z or Y -> Click on Create -> Opens an interface -> Specify function group -> Enter short description -> Click on Continue -> Discard the message -> Opens Function Builder Interface -> In the IMPORT tab button, specify the following parameters:

    A TYPE I

    B TYPE I

    In the EXPORT tab button, specify the following parameter:

    C TYPE I

    In the SOURCE CODE tab button, write the following arithmetic operation statement:

    C = A + B.

    Save the FM -> Activate.

    To invoke the function module from the program, use 'CTRL+F6' shortcut key. Write the following code:

    DATA : X TYPE I VALUE '100', Y TYPE I VALUE '200', Z TYPE I.

    CALL FUNCTION 'ZBASKAR' (CTRL+F6)

    EXPORTING

    A = X

    B = Y

    IMPORTING

    C = Z .

    WRITE Z.

    Save -> Activate -> Execute.

    PASSING INTERNAL TABLE AS AN ARGUMENT:

    -


    Create a FM with the above navigations. In the TABLES tab button, specify the following parameter:

    ITAB LIKE KNA1.

    In the SOURCE CODE tab button, specify the following code:

    LOOP AT ITAB.

    WRITE :/ ITAB-KUNNR, ITAB-NAME1, ITAB-LAND1, ITAB-ORT01.

    ENDLOOP.

    Save -> Activate.

    In the SE38 editor, write the following code to pass internal table as an argument:

    DATA KTAB LIKE KNA1 OCCURS 0 WITH HEADER LINE.

    SELECT * FROM KNA1 INTO TABLE KTAB .

    CALL FUNCTION 'ZBASKAR'

    TABLES

    ITAB = KTAB.

    Save -> Activate -> Execute.

    TO CHANGE THE VALUE OR CHARACTER OF A VALUE (UPPERCASE TO LOWER CASE OR VICE VERSA):

    -


    Click on CHANGING tab button, specify the following parameter:

    STR TYPE C.

    In the SOURCE CODE tab button, specify the following code:

    TRANSLATE STR TO UPPER CASE.

    Save -> Activate.

    In the SE38 editor, write the following code:

    DATA A(10) VALUE 'karthik'.

    CALL FUNCTION 'ZBASKAR'

    CHANGING

    STR = A .

    write a.

    Save -> Activate -> Execute.

    EXCEPTION HANDLING IN FUNCTION MODULE:

    -


    Click on EXCEPTIONS tab button, specify the following parameters:

    TABLE_LESS_SIZE

    TABLE_MORE_SIZE

    Click on SOURCE CODE tab button, specify the following code:

    IF SY-TFILL < 10.

    RAISE TABLE_LESS_SIZE.

    ELSEIF SY-TFILL > 10.

    RAISE TABLE_MORE_SIZE.

    ENDIF.

    Save -> Activate.

    In SE38 editor, write the following code:

    DATA KTAB LIKE KNA1 OCCURS 0 WITH HEADER LINE.

    SELECT * FROM KNA1 INTO TABLE KTAB UP TO 5 ROWS.

    CALL FUNCTION 'ZBASKAR'

    EXCEPTIONS

    TABLE_LESS_SIZE = 1

    TABLE_MORE_SIZE = 2

    OTHERS = 3 .

    DESCRIBE TABLE KTAB.

    IF SY-SUBRC = 1.

    WRITE :/ 'INTERNAL TABLE SIZE IS LESS'.

    ELSEIF SY-SUBRC = 2.

    WRITE :/ 'INTERNAL TABLE SIZE IS MORE'.

    ELSEIF SY-SUBRC = 3.

    WRITE :/ 'INTERNAL TABLE HAS CORRECT NUMBER OF VALUES'.

    ENDIF.

    Some of the common function modules used in BDC and Reports:

    -


    BDC_OPEN_GROUP

    BDC_CLOSE_GROUP

    BDC_INSERT

    UPLOAD

    DOWNLOAD

    WS_UPLOAD

    WS_DOWNLOAD

    REUSE_ALV_GRID_DISPLAY

    REUSE_ALV_LIST_DISPLAY

    Hope this helps u,

    Regards,

    Arunsri

    Edited by: Arunsri on Mar 4, 2008 10:41 AM

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Mar 04, 2008 at 09:41 AM

    Hi,

    A function module is a subroutine with the corresponding function that is centrally

    stored in the Function Library of the SAP system. Each function module has an

    interface for importing or exporting parameters. The main purpose of function

    modules is their reusability. Hence, they belong to the so called reuse components.

    Function modules are organized into function groups. Each function group is a

    collection of function modules that have similar functions and/or process the same

    data.

    A function group can contain the same components as an executable program. These

    include:

    Data objects These are global in relation to the function group, that is, they are visible to and

    changeable by all function modules within the group.

    Subroutines

    These can be called from all function modules in the group.

    Screens

    These can be called from all function modules in the group.

    The properties of a function module include, among other things, the short description

    and the function group it belongs to.

    As is the case with subroutines, a function module can contain local type and data

    object definitions. These can only be seen within the function module.

    The interface of a function module can contain the following elements:

    • Import parameters: They can receive the values or variables of the calling

    program when the function module is called. The optional parameters do not

    have to be supplied with data during the call.

    • Export parameters: The calling program accepts the output of the function

    module through the assignment of a “receiving variable.” Export parameters are

    always optional.

    • Changing parameters: It is possible to pass the variables of the calling program

    that are changed by the function module to the changing parameters.

    • Exceptions: They can be triggered by the function module in certain error

    situations and provide information on the respective processing error in the

    function module. Exceptions should be treated by the calling program.

    In general, the interface parameters are assigned to types from the ABAP Dictionary.

    If a program calls a function module, the entire corresponding function group is

    loaded and the function module is executed. The function group remains loaded in

    the working memory until the calling program is closed. Calling another function

    module of this group is thus processed without repeat loading and with the same

    global data of the function group.

    Thus, if a function module that writes values to the global data of the function group is

    called, other function modules in the same function group can access this data when

    they are called in the same program run.

    Apart from the global data of its function group a function module can also access its

    own, locally defined data objects as well as its interface parameters. The latter are

    used to accept data or return it to the calling program.

    Searching for Function Modules

    Theapplication-related search through the Application Hierarchy should be

    used whenever you want to search for function modules within one/several

    application components.

    • You use the free search via the Repository Information System if you search for

    function modules independent of application components.

    • Theprogram-related search should be used if the function module you are

    searching for is called within an existing program.

    Once you find a function module, you should first find out whether it has been released

    (attributes of the function modules), because you only have the right to support and

    upward compatibility when you use released function modules. We recommend only

    using released function modules.

    You can use the documentation of the function module to find out about its

    functionality and obtain further information.

    Regards,

    Omkaram.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Mar 04, 2008 at 09:41 AM

    Hi,

    A function module is a subroutine with the corresponding function that is centrally

    stored in the Function Library of the SAP system. Each function module has an

    interface for importing or exporting parameters. The main purpose of function

    modules is their reusability. Hence, they belong to the so called reuse components.

    Function modules are organized into function groups. Each function group is a

    collection of function modules that have similar functions and/or process the same

    data.

    A function group can contain the same components as an executable program. These

    include:

    Data objects These are global in relation to the function group, that is, they are visible to and

    changeable by all function modules within the group.

    Subroutines

    These can be called from all function modules in the group.

    Screens

    These can be called from all function modules in the group.

    The properties of a function module include, among other things, the short description

    and the function group it belongs to.

    As is the case with subroutines, a function module can contain local type and data

    object definitions. These can only be seen within the function module.

    The interface of a function module can contain the following elements:

    • Import parameters: They can receive the values or variables of the calling

    program when the function module is called. The optional parameters do not

    have to be supplied with data during the call.

    • Export parameters: The calling program accepts the output of the function

    module through the assignment of a “receiving variable.” Export parameters are

    always optional.

    • Changing parameters: It is possible to pass the variables of the calling program

    that are changed by the function module to the changing parameters.

    • Exceptions: They can be triggered by the function module in certain error

    situations and provide information on the respective processing error in the

    function module. Exceptions should be treated by the calling program.

    In general, the interface parameters are assigned to types from the ABAP Dictionary.

    If a program calls a function module, the entire corresponding function group is

    loaded and the function module is executed. The function group remains loaded in

    the working memory until the calling program is closed. Calling another function

    module of this group is thus processed without repeat loading and with the same

    global data of the function group.

    Thus, if a function module that writes values to the global data of the function group is

    called, other function modules in the same function group can access this data when

    they are called in the same program run.

    Apart from the global data of its function group a function module can also access its

    own, locally defined data objects as well as its interface parameters. The latter are

    used to accept data or return it to the calling program.

    Searching for Function Modules

    Theapplication-related search through the Application Hierarchy should be

    used whenever you want to search for function modules within one/several

    application components.

    • You use the free search via the Repository Information System if you search for

    function modules independent of application components.

    • Theprogram-related search should be used if the function module you are

    searching for is called within an existing program.

    Once you find a function module, you should first find out whether it has been released

    (attributes of the function modules), because you only have the right to support and

    upward compatibility when you use released function modules. We recommend only

    using released function modules.

    You can use the documentation of the function module to find out about its

    functionality and obtain further information.

    Regards,

    Omkaram.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Mar 04, 2008 at 09:42 AM

    Hi ,

    Under one function group there many similar function modules :

    U can write global declaration in the include programs.

    Creation :

    - Goto SE37->Goto->Function Group->Create Group.

    - Give the function group name and short text.

    - Click SAVE button.

    - Activate it.

    Case1 : While creating fngrp it will ask u the package name.

    First check wht r the fngrp's existed under tht

    package.If any include program is inactive open

    tht program and activate it.

    -"The top include is inactive in function group"

    Actually this is the case will occur while exex the

    Function module. Bcaz under one fngrp there

    will be so many fnmodules.Tht u hav to open tht

    fnmodule n Goto->MainProgram there u hav 2

    check the include program which is not active

    and make it as activate.

    Thanks

    Jagadeesh

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Mar 04, 2008 at 09:42 AM

    every function module is assigned for the function group ,

    means for hr you may create a function group,

    for mm you may create a gfunction group,

    like that ....

    <REMOVED BY MODERATOR>

    venkat.

    Edited by: Alvaro Tejada Galindo on Mar 4, 2008 3:15 PM

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Mar 04, 2008 at 10:15 AM
    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.