Application Development and Automation 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: 
Read only

Policy regarding creating global or local classes?

Former Member
0 Likes
639

Hi!

What policy do you have regarding creating local or global classes in your company? We have decided to mostly use local classes since there is a risk of reusing global classes (when changing something in the global class after it has been used by several programs etc.) . But on the other side it is much easier to use transaction SE24 than creating all the includes by hand. Have anyone else made thoughts about this issue?

Regards, Tine

Hi!

What policy do you have regarding creating local or global classes in your company? We have decided to mostly use local classes since there is a risk of reusing global classes (when changing something in the global class after it has been used by several programs etc.) . But on the other side it is much easier to use transaction SE24 than creating all the includes by hand. Have anyone else made thoughts about this issue?

Regards, Tine

3 REPLIES 3
Read only

seshatalpasai_madala
Product and Topic Expert
Product and Topic Expert
0 Likes
588

Hi,

The policy is

<b>Create global class</b> if you want the class to be <b>reused</b>.

And<b> to avoid problems</b> when you change the class, make sure you change class in such a way that it does not effect the existing user's of the class.

Like <b>use OPTIONAL parameters</b> when you change method signature, <b>avoid changing method names</b>, <b>instead add new methods</b>.

You should use local classes only when you are sure that the code there is needed only by your program and nobody else.

If you keep creating local class's and <b>if two programs need the same class it is redundant to create local class's</b> and if you want a change in the class you have to change in all the places.

I hope it is clear.

Regards,

Sesh

Read only

Former Member
0 Likes
588

Thanks! I think we will include your suggestions in our new Guidelines for ABAP OO. But I do not set it answered yet in case there are other opinions on this. I'm just curious to know.

Regards, Tine

Read only

Former Member
0 Likes
588

thanks for your answer