ABAP Objects: Overriding (Redefinition)
Lets check out how we can implement Overriding in ABAP Objects. This is also known as the Redefinition of the method. When do we need to use the Overriding: Overriding is useful, when we want to extend the functionality of the inherited method. For example: we have a generic class of CAR and it has…
ABAP Objects: Narrowing Cast
Important principal of the Inheritence is that an instance of the Subclass can be used in all the contexts where the Superclass can be used. This is possible because the Subclass contains all the attributes of the Superclass, because Subclass has been inhertied from the Super. When we assign the instance of the Subclass back…
ABAP Objects: Widening Cast
When we assign the instance of the Superclass to the Subclass, than it is called the Widening Cast, because we are moving to the “More Specific View” from the “Less specific view”. Everytime it is not possible to move the Superclass reference to the Subclass, because subclass will(or might) have always more functionality compare to…
ABAP Object Design Patterns – Singleton
Today we will try to explore the design patterns in the ABAP Objects. We will start with the Singleton design pattern, which is the simplest of its family of design patterns. UPDATE:This blog post has been updated with clear example demo on 12/17/2009. So, there could be some comments which would be obsolete. What is…
ABAP Objects
ABAP Object Concepts Eloborates the concept of the Method Overriding. Sometimes we refer this as a Redifition of the method. Describes the Narrowing cast concept of the ABAP Objects. Shows the Widening cast concept of the ABAP Objects. Some concepts of the Persistent Objects. Example to demonstrate Persistent Objects Demonstrates the call hierarchy of Constructors….
ABAP Objects Design Patterns – Model View Controller (MVC) Part 1
Today we will discuss about the Design Pattern: Model-View-Controller, which is also very famous by its abbriviation MVC. By definition, MVC is to isolate the business logic from the User Interface which gives great degree of flexibility to change business logic independently to the user interface and vice versa. Basics of MVC In MVC, User…
ABAP Objects Design Patterns – Model View Controller (MVC) Part 2
In this post, we will see how we can implement the MVC (Model-View-Controller) design pattern in ABAP using the Objects. If you have not read the previous discussion about MVC: , than I strongly recommond to read that before moving forward. Demo Application To implement the MVC, we will create two applications – One will…
ABAP Objects Design Patterns – Model View Controller (MVC) Part 3
In this post, we will see how we can implement the Views which will access the Controller and model which is encapsulated in the controller. This post is in continuation of previous post: First Demo Application – ALV For our first Application view will be ALV output. To get the data for the ALV into…
Persistent Object Services – Basics
Some basics used in the Persistent Objects Today we will see some basics about the Persistent Object Services. Why do we need Persistent Object Service:To better understand the need of the persistent objects we need to first understand the concept of the transient data. The local data for the program like Attributes of the class,…
Persistent Object Service – Example
Shows how to use the Persistent object in the Application. Previously, we have seen . Today we will see how to use the Persistent Object services in the test application. You can find all these under . To use the persistent objects, we need to:Get the Agent Object by accessing the public attribute AGENT in…
Object Oriented Design Principles (OODP): Open-Closed Principle(OCP)
Open-Closed Principle (OCP) This is one of my published blogs on SCN – SAP Community Network. Definition:The name itself sounds like contradicting – OPEN & CLOSE, but by definition, A module should be OPEN for extension but CLOSED for modification. The Open-Closed Principle (OCP) is one of the most important Design Principle. OCP originated from…
CLASS_CONSTRUCTOR and CONSTRUCTOR: Who comes before whom?
Today we will see how the constructor and class-constructor triggers at runtime. What is Constructor? Lets see what is CONSTRUCTOR and CLASS_CONSTRUCTOR CONSTRUCTOR Whenever we instantiate the object using the statement CREATE OBJECT statement, CONSTRUCTOR would be called. System creates an object before it calls the CONSTRUCTOR method. CLASS_CONSTRUCTOR This type of constructor is the…
READ-ONLY attribute vs GETTER methods
READ-ONLY is something different for the people who have worked on the OOP in the past. Like JAVA doesn’t have the read only addition. So, there is a hot discussion going on in SAP ABAP Objects world, why READ-ONLY is there and what is the purpose of it. Let’s unleash the READ-ONLY (and its power…
Class Editor – Convert Local Classes to Global Classes
Sometimes, we start designing the class in the program itself. Later in the game, we learn that it would be great if we create this class out of the program and make it global. Thus we can make the class more reusable. We might think, why in the world we started with local class.
Class Editor – Refactoring Assistant – I
While designing the application, there would be lot of instances that we need to move methods, attributes, events or types from a class to another class or an interface. Basically we need to refactor them. But we have to do it manually, it would be too costly and tedeous task when we need to do…
Class Editor – Refactoring Assistant – II
Continuing exploring the Refactoring assistant, we’ll see how we can use the class association in the refactoring assistant.
ABAP Objects Design Patterns – Decorator
Decorator pattern gives us flexibility to extend the behavior of certain objects at runtime.
ABAP Objects Design Patterns – Factory Method
Factory Method design pattern could be most used design pattern in the modern world application. Factory method design pattern hides all the complexity of the instantiating an object from the consumer.
ABAP Objects Design Patterns – Observer
The intent behind the Observer Design Pattern is to define a dependecy between objects so that when main object changes its state, all the dependent objects are notified. Its upto the dependent objects to update themselves or ignore the notification. Design time consideration In the main object, AKA Subject, create a Event. Also add create…
Case Study: Observer Design Pattern Usage
Recently, at one of my client’s place, I have to design a screen with lot of ALVs. When I started designing, I didn’t pay much of the attention to the fact that there could be a dependency between main ALVs and other sub-ALVs. Later in the design phase, I understood that this is a great…