Skip to Content

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.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Best Answer
    avatar image
    Former Member
    Jan 09, 2007 at 03:32 AM

    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

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      hi

      I also want to know the difference between the FM and methods.

      1. "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".

      That means i cannot call a function module(instance of Function grp) more than once in a program.

      Please tell me whether i am right or wrong. Could u please explain me what is the meaning of insatnce of function group..

      Is there any other difference between these two.

      2. what is the difference between static and instance method and function module?

      in which scenario we need to use static and instance methods.?

      Regards

      Sudhansu

  • avatar image
    Former Member
    Jan 09, 2007 at 03:54 AM

    Hello Baskar

    I would like to answer (1):

    Function modules correspond to <b>static</b> methods of classes because all global attributes of the function group are valid all the time when calling one of its function modules. We cannot have instances, i.e. specific dataset combined with coding.

    Thus far we cannot call class methods remotely but we have to use RFC-enabled function modules. However, if you check the possible categories of classes (SE24, tabstrip <i>Properties</i>) there will be great changes in the (near) future ahead!

    Regards

    Uwe

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jan 09, 2007 at 03:34 AM
    Add comment
    10|10000 characters needed characters exceeded