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: 

ABAP OOPs concept

former_member912386
Discoverer
0 Kudos

Is the core class contains public/private/protected Function Modules in it or all the function modules are public?

3 REPLIES 3

former_member627573
Participant
0 Kudos

I think you mean Methods and not Function Modules as your title reads "ABAP OOPs Concept". Methods can be defined under any of the sections; Public, Private and Protected. This is called the visibility sections. Refer to https://help.sap.com/doc/abapdocu_751_index_htm/7.51/en-US/abenclass_visibility.htm to know more about the visibility.

Most methods are defined under Public Section, but for certain requirements methods can be defined under Private and Protected as well.

former_member1716
Active Contributor
0 Kudos

Hello afreen masarath,

They are Methods and yes a Class can have all three types (Public/Private/Protected) of methods depending on the business scenario.

When you want a Method to be used by all the inherited classes you can declare as Public methods else we go for other two types.

Similar methods variables also holds the same differentiation. Recommend you to start with the basics of OOPS concepts, to start with you can follow the below Blog:

BASICS_OOPS

Regard!

michael_koehler2
Participant

Hi Afreen,

Looks like you are mixing up two concepts that have nothing to do with each other.

- Function Modules belong to the 'classic' ABAP, also sometimes referred to as 'Procedural Programming Model'. This has nothing to do with Object Orientation; it came before that.

- Classes are at the center of the ABAP OO Model. There are no Function Modules in ABAP OO; therefore the way you ask your question actually does not make sense. There are no F'n Mods in Classes.

Of course, and that's what is probably confusing you, both models coexist next to each other. That is because lots of older code (still in production) is written using Function Modules, and there is still some use for them today. Whereas (almost) all the newer code is written using OO.

For deeper understanding of OO, please follow Satish's advise.

Hope that clarifies it a bit,
MIke