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

function modules

can u plss tell me how to create a function module and all the necessary things that i need to know abt creating f.modules??

also i want to learn more abt internal tables andwork areas and joins on table. can u tell me how can i do that??

thanks in advance

Add a comment
10|10000 characters needed characters exceeded

Related questions

2 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Dec 05, 2007 at 08:54 AM
    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Dec 05, 2007 at 08:56 AM

    hi,

    To create a function module, you first need to start the Function Builder. Choose Tools ® ABAP Workbench, Function Builder. For more information about creating function modules, refer to the ABAP Workbench Tools documentation.

    To be able to call a function module in an update work process, you must flag it in the Function Builder. When you create the function module, set the Process Type attribute to one of the following values:

    Update with immediate start

    Set this option for high priority ("V1") functions that run in a shared (SAP LUW). These functions can be restarted by the update task in case of errors.

    Update w. imm. start, no restart

    Set this option for high priority ("V1") functions that run in a shared (SAP LUW). These functions may not be restarted by the update task.

    Update with delayed start

    Set this option for low priority ("V2") functions that run in their own update transactions. These functions can be restarted by the update task in case of errors.

    To display the attributes screen in the Function Builder, choose Goto ® Administration.

    Defining the Interface

    Function modules that run in the update task have a limited interface:

    Result parameters or exceptions are not allowed since update-task function modules cannot report on their results.

    You must specify input parameters and tables with reference fields or reference structures defined in the ABAP Dictionary.

    Calling Update Functions

    Synchronous or Asynchronous Processing?

    Function modules that run in the update task can run synchronously or asynchronously. You determine this by the form of the commit statement you use:

    COMMIT WORK

    This is the standard form, which specifies asynchronous processing. Your program does not wait for the requested functions to finish processing.

    COMMIT WORK AND WAIT

    This form specifies synchronous processing. The commit statement waits for the requested functions to finish processing. Control returns to your program after all high priority (V1) function modules have run successfully.

    The AND WAIT form is convenient for switching old programs to synchronous processing without having to re-write the code. Functionally, using AND WAIT for update-task updates is just the same as dialog-task updates with PERFORM ON COMMIT.

    Parameter Values at Execution

    In ABAP, you can call update-task function modules in two different ways. The way you choose determines what parameter values are used when the function module is actually executed. Parameter values can be set either at the time of the CALL FUNCTION statement, or at the time of the COMMIT WORK. The following sections explain.

    Calling Update Functions Directly

    Adding Update Task Calls to a Subroutine.

    The examples in these sections show asynchronous commits with COMMIT WORK.

    Calling Update Functions Directly

    To call a function module directly, use CALL FUNCTION IN UPDATE TASK directly in your code.

    CALL FUNCTION 'FUNCTMOD' IN UPDATE TASK EXPORTING...

    The system then logs your request and executes the function module when the next COMMIT WORK statement is reached. The parameter values used to execute the function module are those current at the time of the call.

    a = 1.

    CALL FUNCTION 'UPD_FM' IN UPDATE TASK EXPORTING PAR = A...

    a = 2.

    CALL FUNCTION 'UPD_FM' IN UPDATE TASK EXPORTING PAR = A...

    a = 3.

    COMMIT WORK.

    Here, the function module UPD_FM is performed twice in the update task: the first time, with value 1 in PAR, the second time with value 2 in PAR.

    Adding Update-Task Calls to a Subroutine

    You can also put the CALL FUNCTION IN UPDATE TASK into a subroutine and call the subroutine with:

    PERFORM SUBROUT ON COMMIT.

    If you choose this method, the subroutine is executed at the commit. Thus the request to run the function in the update task is also logged during commit processing. As a result, the parameter values logged with the request are those current at the time of the commit.

    reward points if useful..

    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.