Application Development 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: 

Instance vs Static Method

Former Member
0 Kudos

I am trying to create a BADI Definition in the Enhancement Spot.

When I am creating a method in the BADI interface; I have the option of INSTANCE and STATIC.

Please elaborate the difference between the two; giving examples.

1 ACCEPTED SOLUTION

Sandra_Rossi
Active Contributor
0 Kudos

it's an elementary concept of object-oriented programming languages, please look at books or lots of threads in the forum.

briefly, you may call instance methods only on instances:

data instance_name type ref to class_name.
create object instance_name...
call method instance_name->instance_method( ... )

you may call static methods (also called class methods) only on class, does not need an instance

call method class_name=>static_method( ... )

2 REPLIES 2

Sandra_Rossi
Active Contributor
0 Kudos

it's an elementary concept of object-oriented programming languages, please look at books or lots of threads in the forum.

briefly, you may call instance methods only on instances:

data instance_name type ref to class_name.
create object instance_name...
call method instance_name->instance_method( ... )

you may call static methods (also called class methods) only on class, does not need an instance

call method class_name=>static_method( ... )

Former Member
0 Kudos

Hi,

Instance methods are called using the following syntax:

CALL METHOD instance_name->instance_method_name.

A static method which is also called as class method can be called using the class and does not require an Instance. Static methods are called using the following syntax:

CALL METHOD class_name=>instance_method_name