ABAP Objects: Objects-Oriented Programming
I know what you are thinking. This fellow cannot spell (and maybe you are right, but that is another story). He even misspelled the title of this blog post!
Correct. I did misspell object-oriented programming, but it was on purpose. Being a native object-oriented developer, I have closely followed and actively participated in the tug a war between the ABAP traditionalists and ABAP objectists during the past +10 years. The more I read, the more I am getting convinced that it is not about being right. It is ABAP religion. Both parties have good intentions and there are pro and cons with both approaches. To make the best out of it, I believe you should embrace both and here some reasons why. I represent a typical SAP customer.
The reason I wrote objectS-oriented programming is simply that we rarely work on single objects in an enterprise computing context. Take for example Horst Keller‘s car example from his ABAP Objects bible. In SAP data processing it is not often you have the luxury of just speeding up one car. In the real world, an internal table is passed from a BAPI call or select statement with 20000 cars and they all need to change speed. It would be absolutely nonsense to convert the internal table into objects, speed up each car object, turning the objects into internal tables again, and finally passing them back to another BAPI call for persistence. However, I would create an object-based car class that contains car related methods. Especially I would focus on wrapping the BAPI calls into simplified customer specific methods so that other programmers would not need to re-investigate BAPI black boxes.
It is my impression that most custom ABAP developments are still based on BAPI calls or select statements for data handling. Both BAPI calls and select statements offer no object-oriented results by default. As long as it is that way, the benefit of ABAP Objects are mainly about having a more structured approach to your ABAP code and the advantages related hereto. The ABAP traditionalists would probably not agree. They claim that it is better to have everything in one place rather than spreading the code over multiple methods. In more object-oriented contexts such as for example Web Dynpro ABAP or CRM, the benefits of using ABAP Objects are more apparent. ABAP remains a hybrid language in the sense of sequential and object-oriented syntax. The question is therefore not about using ABAP Objects or not. It is about knowing where to use it and not. To do that, you must know both. Finding out how to best apply ABAP Objects is one of the most challenging tasks for ABAP developers. Seeing examples of how others have done this helps. I would greatly appreciate even more ABAP Objects stories on SCN.