Posts

Class Inheritance

Image
    Introduction:    We will cover the following basic concepts: Understand the basics of Class Inheritance. Simple example class to understand how we can work with Class Inheritance in different scenarios. We will see the use of SUPER and ME keywords in the context of Inheritance. Create a program to demonstrate the different ways to call methods using Inheritance. Why Class Inheritance? Lets Start 1. Let us create the below comparison chart to understand the basics of  CLASS INHERITANCE. Basic Inheritance Tree Inheritance Basic Comparison Table 2. Lets us create a simple eclipse class and make it work for different scenarios. We will add one method in each visibility section of the Eclipse Class as shown below. PUBLIC_METHOD, PROTECTED_METHOD, and PRIVATE METHOD. Now let us create the implementations for the created methods. Here we have created a FINAL CLASS ( i.e. add the FINAL keyword in the definition section of the class) just to see what happens if we ...

Special Method: Constructor

Image
  Introduction:    We will cover the following basic concepts: Understand, what are constructors. Simple example class, specially designed to understand the basics of Constructors. Create a program to demonstrate different ways constructors behave. Why Constructors? 1. So, what are constructors? Let us understand the basics of the constructors by studying simple differences between normal methods and constructors. 2. Let us start our example by creating a HANA Eclipse class with the below structure. We will create the below 4 methods in the visibility  PUBLIC SECTION of the CLASS DEFINITION . Create a Special Instance Method Constructor with the name CONSTRUCTOR, this is the default name we use to create an instance constructor. We will also create a Normal Instance Method with the name INSTANCE_METHOD. Create a Special Static Method Constructor with the name CLASS_CONSTRUCTOR, this is the default name we use to create a static constructor. And similarly we will ...

Class Visibility

Image
  Introduction:    We will cover the following basic concepts: Simple example class, specially designed to understand the basics of Class Visibility. How visibility of the class components like attributes and methods work. How can a developer utilize the visibility property to his advantage ?.   Use of 'Me' variable Demonstration of visibility in an executable eclipse program. Why use Visibility?   Lets Start : 1. Let us create a class in HANA Eclipse with the following structure. We will define the below components in the class definition. PUBLIC SECTION : This means the class components like Attributes and Methods defined in this section are visible outside the  Class, in Sub-Classes, in an Executable Program. We will create Attribute:  CV_PUBLIC_ATTR with default value 'PUBLIC SECTION'. We will create Method: CM_PUBLIC_METHOD,CM_PUBLIC_MAIN_METHOD. PROTECTED SECTION : This ...

HANA Eclipse Class

Image
 Introduction:    We will cover the following basic concepts: How to create a Class in HANA Studio ( HANA Eclipse ). Basic components of the Class in the HANA Studio. How to create a simple program in the HANA Studio. Old VS New ABAP Syntaxes to call the Method of the Created Class.   Lets Start : 1. Let us Create an Eclipse Class. Login to HANA Eclipse Studio and open the ABAP Perspective. File->New->Other.. Select 'ABAP Class'. We can see the CLASS DEFINITION Section and CLASS IMPLEMENTATION Section generated as shown below. We are going to Define a method in the Public Section of Class Definition. And implement the Method in the Class implementation section as well.        2. Let us learn the Generated Default Components of the class. Line 1 : CLASS CLASS_NAME DEFINITION : Here we define the components of the class.  For Example Attributes, Methods Etc. Line 2 : PUBLIC : This means the Class is a Global Class. Line 3 : FINAL : Thi...

Working with Interfaces

Image
    Introduction : We will cover the following basic concepts:  Basic differences between Classes and Interfaces. Creating Global Interface & Class in SE24. Call Interface Methods in the SE38 program. Basic differences between Interface Methods and Normal Methods . Bonus Point. Lets Start : So what is this 'Interface'? Let us understand it by comparing it with Class as both are created in SE24 with the same screen layout. Interface VS Class       2. Create an Interface in SE24. Let us create an Interface with the name 'ZGLOBAL_INTERFACE'. Click on Create button. Select the 'Interface' radio button. Click on ok. Enter description as shown below. Click on save Create Method Definition as shown below. Note here that the implementation part does not exist. Also, note that there is no Private and Protected Section in the Interface and yes that is interesting. Save and Activate the Interface. Now let us create 2 Global Classes and Implement the Created Inter...