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

Shifting from procedural to object oriented

alejandro_bindi
Active Contributor
0 Likes
2,291

Hi people,

I've been programming in ABAP in a procedural fashion since I started, because that's the way I was taught. Now I want to slowly shift to object oriented development. I know and understand all object oriented concepts (please don't copy paste OOP explanations or links merely to get points). Problem is, in the projects i'm involved everything is done in the old fashion. There's no use of UML whatsoever. I believe it's very difficult to shift my mind to OOP (an already difficult task for someone programming procedural for years) if the analisys and design is not done with OO as the base, as additionally I have very little practical experience with OOP (using ALV classes and such). If every other programmer does things in procedural way, when the time comes to integrate programs, problems arise.

I've been experimenting with OOP in my safe minisap at home, but in day to day work as pressure is put to finish programs on time, always procedural solutions come to mind.

Do you have any advice on how to cope with this? Can you post your experience on this subject? Has someone gone through this same problems?

Many thanks.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
2,123

Hi Alejandro,

The change should basically come at the way you look at everything. To get used to the OOPS way, you should start looking at everything as objects.

Make the DATA as the basis for your program rather than the PROCESS of extracting/processing it.

Having said that, it is not so easy also. You should probably look at some standard programs.

Start with ABAPDOCU transaction wherein you can find small examples Under ABAP Objects node, if you haven't done that already.

Regards,

Ravi

Hi Alejandro,

The change should basically come at the way you look at everything. To get used to the OOPS way, you should start looking at everything as objects.

Make the DATA as the basis for your program rather than the PROCESS of extracting/processing it.

Having said that, it is not so easy also. You should probably look at some standard programs.

Start with ABAPDOCU transaction wherein you can find small examples Under ABAP Objects node, if you haven't done that already.

Regards,

Ravi

9 REPLIES 9
Read only

Former Member
0 Likes
2,124

Hi Alejandro,

The change should basically come at the way you look at everything. To get used to the OOPS way, you should start looking at everything as objects.

Make the DATA as the basis for your program rather than the PROCESS of extracting/processing it.

Having said that, it is not so easy also. You should probably look at some standard programs.

Start with ABAPDOCU transaction wherein you can find small examples Under ABAP Objects node, if you haven't done that already.

Regards,

Ravi

Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
2,123

You know, I think we may be in the same boat. I am really ashamed to admit this, but we actually have exactly one custom class in our system, which I just created a couple months ago and we've been live for 6 years. Although I am comfortable with ABAP OO, I am the only one that is at my company, so in writing code in OO, it would confuse everyone else. In my case, I was waiting till after our upgrade to ECC 6.0 to really drive the OO adoption at my company, since there is a lot of functionality which is OO based. We are still on 46c, so we can get away with it now, but in new releases, OO is going to become more and more important. Just look at WebDynpro ABAP, it is all OO based.

Regards,

Rich Heilman

Read only

0 Likes
2,123

Hello Rich,

you take the words from my tongue. By the way, by this day to day pressure, still I try to find the time for my home installed MiniSAP and if I there is new developing in the work I do it with OO even if stil on 4.6C.

Bye,

Peter

Read only

Pawan_Kesari
Active Contributor
0 Likes
2,123

I remembered how I started writing code in OOPs.

Earlier I was used to code in C and when I started working in C+, I tend to write code in C even in C+ environment.

I think your situation is same as I was at that time because ABAP complier support both procedural and OOPs ABAP (as was the case with C++ complier) .

I started with writing code in class by merely putting things in methods. I was not using concepts like inheritance, overloading or runtime polymorphism (sorry for using these words). Slowly and slowly I realize need for these concepts and started using it. Though I mistakes (specially in designing classes) but I learned.

So my suggestion is keep theory in mind and start putting code in classed and method. You will automatically use the concepts in few days.

Read only

0 Likes
2,123

Many thanks for your valuable posts reflecting your experiences. I'll award points on the basis of "first come first serve" since you all helped.

But do you agree that a more profound change is needed around SAP projects in the way system modifications get done? Not just at programming level, but i think functional analysts should also learn and use for example UML to define requirements.

As for me, i'll start as you said Pawan, it's just that i know doing that is playing dirty, but maybe as you say learning from mistakes will help in the process (as almost always

Read only

marcelo_ramos1
SAP Mentor
SAP Mentor
0 Likes
2,123

Hi,

Don't worry about how to apply the new concept, Just learn and train.

Slowly goes applying in the company, this increases the interest of the other programmers and the it responsible to know the new Concept.

This happened with me, and now my company allows me to decide when and as to use the new concept. Today I am responsible for the training of ABAP objects in the company.

Regards.

Marcelo Ramos

Read only

0 Likes
2,123

Thanks Marcelo for your experience.

Read only

uwe_schieferstein
Active Contributor
0 Likes
2,123

Hello Alejandro

When I started with object-oriented ABAP programming about 2 years ago I made horrible mistakes in my classes and interfaces. However, I have my lessons learnt from these mistakes and improved my skills and knowledge step by step.

I have 3 recommendations for you:

<b>(1) Start now!</b>

Do not expect to develop perfect interfaces and classes from the very beginning. Understanding Object-Orientation takes its time.

<b>(2) Start with simple objects.</b>

Interfaces (or classes) can be used to define globally visible constants. Your first classes may contain only static methods. Yet while developing these "simple" objects you will get familiar with the class builder (SE24).

<b>

(3) Make heavy use of SAP standard classes.</b>

Before creating your own class(es) make a comprehensive search for available standard classes (of course, if you are dealing with custom-developed business objects you have to create your own classes).

For example, if you have to work with purchase orders have a look at the following classes:

- CL_PO_HEADER_HANDLE_MM

- CL_PO_ITEM_HANDLE_MM

If you create an instance of CL_PO_HEADER_HANDLE_MM you will have thousands of coding lines at your fingertip (e.g. method IF_PURCHASE_ORDER_MMGET_DATA returns the header data, method IF_PURCHASE_ORDER_MMGET_ITEMS returns the order items -> no need of coding, just CALLING).

Finally, you may have a look at the following examples:

<a href="https://wiki.sdn.sap.com/wiki/display/profile/2007/07/09/UnderstandingABAPObjects">Understanding ABAP Objects</a>

<a href="https://wiki.sdn.sap.com/wiki/display/profile/2007/07/09/MessageHandling-FindingtheNeedleintheHaystack">Message Handling - Finding the Needle in the Haystack</a>

<a href="https://wiki.sdn.sap.com/wiki/display/Snippets/UnifiedAccesstoAllHR+Infotypes">Unified Access to All HR Infotypes</a>

Regards

Uwe

Read only

0 Likes
2,123

Hello Uwe,

thank you for all your responses here in SDN->ABAP Objects! Really Great Work!

Bye,

Peter