Difference between Function Module Vs Method in Class Module

1) Can you please tell the difference between the Function module used in abap program and the method of the class module used in abap programming.
2) does it necessary to do commit statement after calling the function module.
Thankyou for you time.
Bhaskar.

Hi,
1)
Check this difference..
The main difference between real object orientation and function groups is that although a program can work with the instances of several function groups at the same time, it cannot work with several instances of a single function group. Suppose a program wanted to use several independent counters, or process several orders at the same time. In this case, you would have to adapt the function group to include instance administration, for example, by using numbers to differentiate between the instances.
2) COMMIT WORK is required for BAPI..And not required when you normally call a function module..Unless required ..
Example
Update function modules requires COMMIT WORK to execute the function module.
Thanks,
Naren

Similar Messages

  • Difference between function module and a method?

    Hi Experts
    Can anybody pls tell me the technical and functional difference between function moduel and a method?
    Thanks
    Sudhansu

    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 modules allow you to encapsulate and reuse global functions in the R/3 System. They 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 also play an important role in database updates and in remote communications between R/3 Systems or between an R/3 System and a non-SAP system.
    You can declare methods in the declaration part of a class or in an interface. To declare instance methods, use the following statement:
    METHODS <meth> IMPORTING.. [VALUE(]<ii>[)] TYPE type [OPTIONAL]..
                   EXPORTING.. [VALUE(]<ei>[)] TYPE type [OPTIONAL]..
                   CHANGING.. [VALUE(]<ci>[)] TYPE type [OPTIONAL]..
                   RETURNING VALUE(<r>)
                   EXCEPTIONS.. <ei>..
    When you declare a method, you also define its parameter interface using the additions IMPORTING, EXPORTING, CHANGING, and RETURNING. The additions define the input, output, and input/output parameters, and the return code. They also define the attributes of the interface parameters, namely whether a parameter is to be passed by reference or value (VALUE), its type (TYPE), and whether it is optional (OPTIONAL, DEFAULT).
    Unlike in function modules, the default way of passing a parameter in a method is by reference.
    As in function modules, you can use exception parameters (EXCEPTIONS) to allow the user to react to error situations when the method is executed.
    As in function modules, you can use the RAISE <exception> and MESSAGE RAISING statements to handle error situations.
    Regards,
    Sruthi

  • What is the difference between function and method

    Hey I need help I dont know which is the difference between function and method ?
    Does anybody can ask me this question.
    Thanks

    jverd wrote:
    The first two answers were also correct.Also the blocked message, quoted here for posterity:
    "Tinkerbell" wrote:
    Methods are defined by Java whereas functions are not. ~

  • Difference between function module and userexit and badi

    Hello Gurus,
                    As a functional consultant i want to know what is function module and user exit and badi.
    what is the difference between function module , user exit and badi?
    regds
    Ramachandra

    Rama,
    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.
    Business Add-Ins are a new SAP enhancement technique based on ABAP Objects. They can be inserted into the SAP System to accommodate user requirements too specific to be included in the standard delivery. Since specific industries often require special functions, SAP allows you to predefine these points in your software.
    User exit - A user exit is a three character code that instructs the system to access a program during system processing.
    SXX: S is for standard exits that are delivered by SAP.   XX represents the 2-digit exit number.
    UXX: U is for user exits that are defined by the user.  XX represents the 2-digit exit number .
    Difference between BADI and USER-EXIT.
        i) BADI's can be used any number of times, where as USER-EXITS can be used only one time.
           Ex:- if your assigning a USER-EXIT to a project in (CMOD), then you can not assign the same to other project.
        ii) BADI's are oops based.
    Hope this helps you.
    Rgds
    Manish

  • What's the difference between equals() and compareTo() method

    I'm confused between the two method from String class ,,, what's the main difference between equals() and compareTo() method?

    API docs give quite clear information IMHO
    public boolean equals(Object anObject)
    Compares this string to the specified object. The result is true if and only if the argument is not null and is
    a String object that represents the same sequence of characters as this object.
    public int compareTo(String anotherString)
    Compares two strings lexicographically. ....
    The result is a negative integer if this String object lexicographically precedes the argument string. The
    result is a positive integer if this String object lexicographically follows the argument string. The result is
    zero if the strings are equal; compareTo returns 0 exactly when the equals(Object) method would return
    true. Mike

  • Exact difference between function and procedure

    exact difference between function and procedure(real time diff.....not like return value, dml....) and function do some work at the same time that work also do procedure..why function

    ranitB wrote:
    1. Function is called Inline a query. A return value is must.
    But, procedure may/may not contain a return value.Not true.
    A function may be called in a query providing it meets certain limitations (no DDL, or transactional statements such as commit/rollback etc.).
    A function does not have to be called from a query, it can be called from other PL/SQL code or from other external applications.
    Regular functions must return a value, though pipelined functions do not...
    SQL> CREATE OR REPLACE TYPE split_tbl IS TABLE OF VARCHAR2(32767);
      2  /
    Type created.
    SQL> CREATE OR REPLACE FUNCTION split (p_list VARCHAR2, p_delim VARCHAR2:=' ') RETURN SPLIT_TBL PIPELINED IS
      2      l_idx    PLS_INTEGER;
      3      l_list   VARCHAR2(32767) := p_list;
      4      l_value  VARCHAR2(32767);
      5    BEGIN
      6      LOOP
      7        l_idx := INSTR(l_list, p_delim);
      8        IF l_idx > 0 THEN
      9          PIPE ROW(SUBSTR(l_list, 1, l_idx-1));
    10          l_list := SUBSTR(l_list, l_idx+LENGTH(p_delim));
    11        ELSE
    12          PIPE ROW(l_list);
    13          EXIT;
    14        END IF;
    15      END LOOP;
    16      RETURN;
    17    END SPLIT;
    18  /
    Function created.
    SQL> SELECT column_value
      2  FROM TABLE(split('FRED,JIM,BOB,TED,MARK',','));
    COLUMN_VALUE
    FRED
    JIM
    BOB
    TED
    MARK... whilst the definition of the function shows a return type, the return statement inside the function simply returns, without a value. That's because the data is passed back through a special "pipeline", and you can write code to show that the data is available to a query as soon as it's piped, and before the function has completed (reached the return statement) if you like.
    A procedure does not return a value (And no an OUT parameter is not a "returned" value, it's a writeable parameter, there's a difference)
    2. There are some limitations in functions which is possbl through procedures.
    Like - Oracle doesn't support DML in functions called in Select queries (using PRAGMA AUTONOMOUS_TRANSACTION will help).Not strictly true. and SQL query is considered to be DML, so a function could perform a query and then be used inside another query...
    SQL> ed
    Wrote file afiedt.buf
      1  create or replace function f_dname(p_deptno in number) return varchar2 is
      2    v_dname varchar2(10);
      3  begin
      4    select dname into v_dname
      5    from   dept
      6    where  deptno = p_deptno;
      7    return v_dname;
      8* end;
    SQL> /
    Function created.
    SQL> ed
    Wrote file afiedt.buf
      1* select empno, ename, f_dname(deptno) as dname from emp
    SQL> /
         EMPNO ENAME      DNAME
          7369 SMITH      RESEARCH
          7499 ALLEN      SALES
          7521 WARD       SALES
          7566 JONES      RESEARCH
          7654 MARTIN     SALES
          7698 BLAKE      SALES
          7782 CLARK      ACCOUNTING
          7788 SCOTT      RESEARCH
          7839 KING       ACCOUNTING
          7844 TURNER     SALES
          7876 ADAMS      RESEARCH
          7900 JAMES      SALES
          7902 FORD       RESEARCH
          7934 MILLER     ACCOUNTING
    14 rows selected.It's been discussed many times on the forum... my favourite here...
    {message:id=1668675}
    Edited by: BluShadow on 17-Sep-2012 09:22

  • Differences between function based index and normal index

    Hi,
    Please Give me some differences between function based index and normal indexes.
    1. Is there any performance gain in function based index?
    2. Why indexes created in DESC are treated as function based?
    3. Every DESC index is b-tree index?
    Thanks

    check this link. This would give u a basic idea of what a function based index is .
    http://www.oracle-base.com/articles/8i/FunctionBasedIndexes.php
    --Prasad                                                                                                                                                                                                                                                                                                                                       

  • Difference between functional task and interface task

    Hi All,
    Kindly let me know the Difference between functional task and interface task when we create a task profile.
    Regards,
    Swetha

    Hi Sweta,
    The diferennce is Like we create different roles like store incharge and Store manager for Store manager there are list of activities that he can do like approve requests from store keeper and so on so these are Interface tasks as there are differences based on the roles of the employee but if a person can only create and not approve the transation then this is functional task difference

  • What's the difference between defining a Thread within a class and....

    Guys,
    I am really confused when it comes to thread.
    What's the difference between defining a Thread within a class and implementing a Thread in a class?
    I just want to know about this. What is the difference between the two code classes?
    public class A
    public A()
    public Start()
    Thread th = new Thread():
    th.start(this);
    public class A extends Thread
    public A()
    *{*{code}*}*  
    *public Start()*
    *run();*

    My Googling show that the E/A may be a little newer but it appears that the E/A was not originally sold in the USA. The E/A appears to be sold in a Spanish speaking country.

  • Difference between Function module in Update task

    Hi folks,
    What is the difference between
    1. A function module calling in 'update task'( if attributes not set for update mode).
    2.A function module's attributes set to update mode, but while calling not specified 'Update task'.
    Please clarify this doubt.
    Thanks in advance.
    Bhavani

    CALL FUNCTION func IN UPDATE TASK.
    Additions:
    1. ... EXPORTING  p1 = f1     ... pn = fn
    2. ... TABLES     p1 = itab1  ... pn = itabn
    Effect
    Flags the function module func for execution in the update task. It is not executed at once, but the data passed with EXPORTING or TABLES is placed in a database table and a subsequent COMMIT WORK then causes the function module to be executed by the update task. Update function modules must be flagged as such in the Function Builder
    The return value is not set.
    Addition 1
    ... EXPORTING p1 = f1 ... pn = fn
    Effect
    Values of fields and field strings specified under EXPORTING are passed from the calling program to the function module. In the function module, the formal parameters are defined as import parameters. In the interface definition, default values must be assigned to all import parameters of the update function module.
    Addition 2
    ... TABLES p1 = itab1 ... pn = itabn
    Effect
    TABLES passes references to internal tables. All table parameters of the function module must have values.
    Note
    With update function modules, both import parameters and exceptions are ignored when the call is made.
    Administration transaction
    Related
    COMMIT WORK, SET UPDATE TASK LOCAL
    regards,
    kartikey.

  • Difference between Function Module and Routine

    Hi,
      I am zero at ABAP Skill.
      Can any one explain me what is the difference between Routine in BW  and Function Module .
    Thanks

    Hi,
    well basically it is almost the same. Both have a defined interface. You can pass variables to them and they can return variables. They can also change parameters... The main difference is, that a routine (form routine) can be used within the program where it is defined only and a function module can be used in all programs, form routines.
    regards
    Siggi

  • Difference Between Function Module And BAPI

    Hi Friends,
    What is the technical difference between BAPI and Function Module (Normal, RFC and update)?
    When do we use BAPI and FM?
    If BAPI is also RFC enabled then why do we have RFC function module?
    Kindly clarify with examples.
    Regards,
    Pradeep Singh Dhadwal

    Hi Pradeep,
    BAPI vs FM
    Difference between FM and BAPI
    BAPI stands for Business API(Application Program Interface).
    A BAPI is remotely enabled function module
    ie it can be invoked from remote programs like standalone JAVA programs, web interface etc..
    You can make your function module remotely enabled in attributes of Function module but
    A BAPI are standard SAP function modules provided by SAP for remote access.
    Also they are part of Businees Objest Repository(BOR).
    BAPI are RFC enabled function modules. the difference between RFc and BAPI are business objects.
    You create business objects and those are then registered in your BOR (Business Object Repository)
    which can be accessed outside the SAP system by using some other applications (Non-SAP) such as VB or JAVA.
    FM
    Normal FM used internally inside SAP.
    Hope this helps,
    Manish

  • Difference between function module and subroutines

    hey all...
    can u pls explai me the exact difference between subroutines and function modules...
    also, when is a sub routine used and also when is a function module used..???
    regards..
    vishal

    Hi Vishal,
    Basically they do the same thing and purpose is almost same but tecnically the are way apart:
    Function modules must belong to a pool called a function group.
    They possess a fixed interface for data exchange. This makes it easier for you to pass input and output parameters to and from the function module.
          For example, you can assign default values to the input parameters. The interface also supports exception handling. This allows you to catch errors and pass them back to the calling program for handling.
    They use their own memory area. The calling program and the function module cannot exchange data using a shared memory area - they must use the function module interface. This avoids unpleasant side effects such as accidentally overwriting data.
    You call a function module by its name (which must be unique) in a CALL FUNCTION statement.
    and also
    Unlike subroutines, you do not define function modules in the source code of your program. Instead, you use the Structure link Function Builder.
    Check this link too
    Re: Regarding difference between Subroutines and Function modules
    Hope this helps you,
    Regards
    Amit
    Message was edited by: Amit Kumar

  • Difference between compare nad compareTo method

    difference between compare nad compareTo method

    compareTo is a method of the Comparable interface; it takes one argument and compares the current object to that argument; it provides a default ordering of the objects of this class
    compare is a method of the Comparator interface; it takes two arguments and compares them; it is used to provide an external ordering, either for things that don't already have an ordering, or to provide a different ordering than the one they already have

  • What's the difference between this and super in this class

    public interface Doggie {
    public void wao();
    public void fetchBall();
    public void run();
    public void sleep();
    public class Kittie {
    public void miao() {
    public void catchRat() {}
    public void run() {}
    public void sleep() {}
    public class KtoD extends Kittie implements Doggie {
    public void wao() {
    this.miao();//here super.miao() will work too,
    //what is the difference between them?
    public void fetchBall() {
    this.catchRat();//here too
    public void run() {
    super.run();
    public void sleep() {
    super.sleep();
    }

    well, just off the top of my head (someone who wants to quote the relevant parts of the JLS can reply here too) - this makes sense, because your KtoD class extends Kittie, which has a miao method. You've not overridden this method, so KtoD's miao method is Kittie's method. Thus, this.miao() and super.miao() refer to the same method. If you had overridden this method in your KtoD class then this.miao() would refer to the overridden miao method, and if you had wanted to call the miao method from Kittie then you would have had to use super.miao()
    Did that answer your question?
    Lee

Maybe you are looking for

  • Need to upload from IPOD to NEW computer

    My computer disk went bad and is unrecoverable.   I have a new PC and am trying to UPLOAD the CDs from my IPOD to my new computer.   I have not been able to find any help on how to do this.   I don't want to have to reload my entire CD library (which

  • ORA-06502 in the Tree Report

    I am encountering the following error on my Tree report occasionally. "Unexpected error ORA-06502: PL/SQL: numeric or value error: character string buffer too small". Apex version 3.x (I think not sure), Database 10.1.0.4 I have noticed that I can ke

  • CR Parameter Cancel Button

    Hi Experts, while trying to refresh the Crystal report from Launchpad, when the parameter screen pops up isn't there a way that i can cancel or close the prompt screen? I only see OK which triggers the refresh again once i click on OK. Can't i just c

  • Creating a greeting card

    Hi, I am trying to make a greeting card but it keeps telling me that my picture size is not valid with that creation. I have tried re sizing it but I don't guess I know what I am doing, can some one please help me??

  • Having problems syncing recurring meetings from exchange

    not only me on this version but many people in our company that use various versions of iphones and iOS are having problems getting recurring meeting exceptions to properly sync in the iphone calendar. we use hardware 3GS, 4, 4GS and 5 - iOS versions