Sunteți pe pagina 1din 12

What are the main differences between Procedural and Object oriented programming?

Sl No

Procedure Oriented

Object Oriented

Emphasis on doing things.

Emphasis on data rather than procedure.

Large programs are divided into smaller programs known as functions.

Programs are divided into objects.

Most of the functions share global data.

Data structures are designed such that they characterized the objects.

Data move openly around the system from function to function.

Functions that operate on the data of an object are tied together in the data structure.
Data is hidden and cannot be accessed by external functions.

Top-down approach.

In general:

Bottom-up approach.

1)functions

1) methods

2)modules

2)objects

3)call

3)message

4)variable

4)attribute

What are the advantages of ABAP OOPS?

1.

Through inheritance we can eliminate redundant code and extend the use of existing class.

2.

We can develop programs from the existing classes given by SAP.

3.

The concept of data hiding helps the programmer to build secure programs that cannot be invaded by code in other parts of programs.

4.

OOP system can be easily upgraded from smaller system to larger system.

5.

Software complexity can be easily managed.

6.

Code reusability.

7.

For interfacing ABAP with Microsoft technologies, Java as all these are Build on the concept of OOP .

8.

To easily understand the recent concepts of ABAP ex BAPI, BADI workflow.

What are the core ABAP oops concepts?

Inheritance: Inheritance is the ability of an object to inherit the properties and methods of another object. This characteristic leads to the creation of families of objects (just like
families exist for humans) with parent objects and child objects.
Polymorphism: Polymorphism is about an objects ability to provide context when methods or operators are called on the object.
Definition: Polymorphism
In object-oriented programming, polymorphism (from the Greek meaning "having multiple forms") is the characteristic of being able to assign a different meaning to a particular
symbol or "operator" in different contexts. The simple example is two classes that inherit from a common parent and implement the same virtual method.
Encapsulation: Encapsulation is the ability that an object has to contain and restrict the access to its members. Encapsulation is a key concept of object programming that
ensures the autonomy and integrity of the objects.
Abstraction: Another OOP concept related to encapsulation that is less widely used but gaining ground is abstration.
Definition: Abstraction
Through the process of abstraction, a programmer hides all but the relevant data about an object in order to reduce complexity and increase efficiency. In the same way that
abstraction sometimes works in art, the object that remains is a representation of the original, with unwanted detail omitted. The resulting object itself can be referred to as an
abstraction, meaning a named entity made up of selected attributes and behavior specific to a particular usage of the originating entity.

What is UML?

UML (Unified Modeling Language) is a standardized modeling language. It is used for the specification, construction, visualization and documentation of models for software
systems and enables uniform communication between various users.
UML does not describe the steps in the object-oriented development process.
SAP uses UML as the company-wide standard for object-oriented modeling.
UML describes a number of different diagram types in order to represent different views of a system.

What are the types of Objects and Classes?

In general there are two types of Objects: Instance Object and Static Object and as such there are two types of Classes: Instance class and Static Class.
Specifically when it comes to visibility, Private class, Protected class and Public classes are the types of classes one can have.

What are the types of classes which can be created?

We can create four types of classes under final and only modeled category(optional) with the private, protected, public and abstract instantiation.
Usual Abap Class.
Exception Class(With/Without messages).
Persistent Class.
Test Class(ABAP Unit).

What are local and global classes?

classes in ABAP Objects can be declared either globally or locally.


You define global classes and interfaces in the Class Builder (Transaction SE24) in the ABAP Workbench.
They are stored centrally in class pools in the class library in the R/3 Repository. All of the ABAP programs in an R/3 System can access the global classes.
Local classes are defined within an ABAP program. Local classes and interfaces can only be used in the program in which they are defined.
When you use a class in an ABAP program, the system first searches for a local class with the specified name. If it does not find one, it then looks for a global class.
Apart from the visibility question, there is no difference between using a global class and using a local class.
If you are defining a local class that is only used in a single program, it is usually sufficient to define the outwardly visible components so that it fits into that program.
Global classes, on the other hand, must be able to be used anywhere. This means that certain restrictions apply when you define the interface of a global class, since the
system must be able to guarantee that any program using an object of a global class can recognize the data type of each interface parameter.
Local classes consist of ABAP source code, enclosed in the ABAP statements CLASS ... ENDCLASS. A complete class definition consists of a declaration part and, if required,
an implementation part. The declaration part of a class <class> is a statement block:
CLASS <class> DEFINITION.
...
ENDCLASS.
It contains the declaration for all components (attributes, methods, events) of the class. When you define local classes, the declaration part belongs to the global program data.
You should therefore place it at the beginning of the program.
If you declare methods in the declaration part of a class, you must also write an implementation part for it. This consists of a further statement block:
CLASS <class> IMPLEMENTATION.
...
ENDCLASS.
The implementation part of a class contains the implementation of all methods of the class. The implementation part of a local class is a processing block. Subsequent coding
that is not itself part of a processing block is therefore not accessible.
rt of a processing block is therefore not accessible.

What is a reference variable?

Objects can only be created and addressed using reference variables. Reference variables allow you to create and address objects. Reference variables can be defined in
classes, allowing you to access objects from within a class.
Ex.
...
CLASS lcl_vehicle DEFINITION.
PUBLIC SECTION.

PRIVATE SECTION.

ENDCLASS.
CLASS lcl_vehicle IMPLEMENTATION.

ENDCLASS.
DATA: r_vehicle1 TYPE REF TO lcl_vehicle,
r_vehicle2 TYPE REF TO lcl_vehilce.
START-OF_SELECTION.
rt of a processing block is therefore not accessible.

What is a reference variable?

Objects can only be created and addressed using reference variables. Reference variables allow you to create and address objects. Reference variables can be defined in
classes, allowing you to access objects from within a class.
Ex.
...
CLASS lcl_vehicle DEFINITION.
PUBLIC SECTION.

PRIVATE SECTION.

ENDCLASS.
CLASS lcl_vehicle IMPLEMENTATION.

ENDCLASS.
DATA: r_vehicle1 TYPE REF TO lcl_vehicle,
r_vehicle2 TYPE REF TO lcl_vehilce.
START-OF_SELECTION.

What are Abstract classes and an Abstract Method?

Abstract classes themselves cannot be instantiated (although their subclasses can) References to abstract classes can refer to instances of subclasses. Abstract (instance)
methods are defined in the class, but not implemented. They must be redefined in subclasses.
Abstract instance methods are used to specify particular interfaces for subclasses, without having to immediately provide implementation for them. Abstract methods need to be
redefined and thereby implemented in the subclass (here you also need to include the corresponding redefinition statement in the DEFINITION part of the subclass).
Classes with at least one abstract method are themselves abstract.
Static methods and constructors cannot be abstract (they cannot be redefined).

Abstract method
Abstract instance methods are used to specify particular interfaces for subclasses, without having to immediately provide implementation for them. Abstract methods need to be
redefined and thereby implemented in the subclass (here you also need to include the corresponding redefinition statement in the DEFINITION part of the subclass). Classes
with at least one abstract method are themselves abstract. Static methods and constructors cannot be abstract (they cannot be redefined).

What is the difference between Abstract method and a Final method?

Abstract method
Abstract instance methods are used to specify particular interfaces for subclasses, without having to immediately provide implementation for them. Abstract methods need to be
redefined and thereby implemented in the subclass (here you also need to include the corresponding redefinition statement in the DEFINITION part of the subclass). Classes
with at least one abstract method are themselves abstract. Static methods and constructors cannot be abstract (they cannot be redefined).
Abstract (instance) methods are defined in the class, but not implemented
They must be redefined in subclasses.
CLASS lcl_vehicle DEFINITION ABSTRACT.
PUBLIC SECTION.
METHODS estimate_fuel_consumption ABSTRACT
IMPORTING ...
ENDCLASS.
Final method
Final classes cannot have subclasses.
Final methods cannot be redefined in subclasses.
A final class implicitly only contains final methods. In this case, you cannot enter FINAL explicitly for these methods. Methods cannot be both final and abstract. Classes, on the
other hand, that are both abstract and final can be useful: Only static components can be used.

Final methods cannot be redefined in subclasses


CLASS lcl_bus DEFINITION INHERITING FROM lcl_vehicle.
PUBLIC SECTION.
METHODS estimate_number_of_free_seats FINAL.
ENDCLASS.

What is a super class? How can it be implemented?

A superclass is a generalization of its subclasses. The subclass in turn is a specialization of its superclasses.
CLASS lcl_vehicle DEFINITION.
PUBLIC SECTION.
METHODS estimate_fuel
IMPORTING im_distance TYPE ty_distance
RETURNING VALUE(re_fuel) TYPE ty_fuel.
ENDCLASS.
CLASS lcl_truck DEFINITION INHERITING FROM lcl_vehicle.
PUBLIC SECTION.
METHODS estimate_fuel REDEFINITION.
ENDCLASS.
CLASS lcl_truck IMPLEMENTATION.
METHOD estimate_fuel.
super->estimate_fuel(...)
ENDMETHOD.
ENDCLASS.

What is a Narrowing Cast? How can you implement it?

The assignment of a subclass instance to a reference variable of the type "reference to superclass" is described as a narrowing cast, because you are switching from a more
detailed view to a one with less detail.
It can be implemented as follows.
After the narrowing cast, you can use the r_vehicle reference to access the components of the truck instance that were inherited from lcl_vehicle - obviously, in some cases with
the limitations entailed by their visibility. You can no longer access the truck-specific part of the instance (get_cargo in the above example) using the r_vehicle reference.
DATA: r_vehicle TYPE REF TO lcl_vehicle,
r_truck TYPE REF TO lcl_truck.
CREATE OBJECT r_truck.
* Narrowing Cast
r_vehicle = r_truck
Principle of Narrowing Cast
_r_truck_
_r_vehicle_

What is a Widening Cast?

The widening cast is, as with inheritance, the opposite of the narrowing cast: Here it is used to retrieve a class reference from an interface reference.

METHOD get_max_cargo.
DATA: r_vehicle TYPE REF TO lcl_vehicle,
r_truck TYPE REF TO lcl_truck.
LOOP AT vehicle_list INTO r_vehicle.
TRY.
r_truck ?= r_vehicle.
* put max cargo in variable re_cargo...
CATCH cx_sy_move_cast_error.
* react on that cast error
ENDTRY.
ENDLOOP.

What is a singleton?

If it is to be impossible to instantiate a class more than once (for example, because it serves as a data administrator or data container), you can use the singleton concept. The
class is defined with the addition CREATE PRIVATE and FINAL and instantiated using its static constructor. A public static component could then make the reference to the
class available to an external user.
DATA: r_single type ref to cl_singleton.
START-OF-SELECTION.
r_single = cl_singleton=>get_singleton( ).

What is a constructor?

Special method for creating objects with defined initial state, Only has IMPORTING,
parameters and EXCEPTIONS, Is executed only once per instance.
Example of Constructor
CLASS my_class DEFINITION.

PUBLIC SECTION.
METHODS CONSTRUCTOR. note constructor should be always declared in public.
ENDCLASS.
CLASS my_class IMPLEMENTATION.
METHODS CONSTRUCTOR.
write :/ this is constructor method.
ENDMETHOD.
ENDCLASS.

What are the limitations of redefining a method?

Inherited methods can be redefined in subclasses Redefined methods must be re-implemented in subclasses. The signature of redefined methods cannot be changed Static
methods cannot be redefined. In inheritance, static components are "shared": A class shares its non-private static attributes with all its subclasses. In ABAP Objects, you can
not only add new components, but also provide inherited methods with new implementations. This is known as redefinition. You can only redefine (public and protected)
instance methods, other components (static methods, attributes and so on) cannot be redefined. Changes to method parameters (signature changes) are not possible..

What are static components? What is a component selector ?

In inheritance, static components are "shared": A class shares its non-private static attributes with all its subclasses. => and -> are the component selectors used to refer.

What are component instance?

A component instance is a running component that can be run in parallel with other instances of the same component.

How is Encapsulation implemented in OOPs?

Encapsulation means that the implementation of an object is hidden from other components in the system, so that they cannot make assumptions about the internal status of
the object and therefore dependencies on specific implementations do not arise.

What are interfaces? What are the advantages of interfaces?

Interfaces are the means of choice for describing external points of contact or protocols, without linking them to a type of implementation. An extra layer is introduced between
the client and the server to protect the client explicitly from the server, thereby making the client independent. Interfaces enable you to work uniformly with different classes
(providers/servers). In particular, they always ensure polymorphic behavior as they do not have their own implementation, but instead allow the providers to carry it out. The
definition of an interface is always an abstraction: The user wants to handle various providers in the same way and must therefore abstract concrete implementations to a
description of the services required to fulfill the task. You can also use interfaces to achieve multiple inheritance by defining the functionality to be inherited by a second class as
an interface that the inheriting class then has to implement.
INTERFACE lif_partners.
METHODS: display_partner.
ENDINTERFACE.
CLASS lcl_rental DEFINITION.
PUBLIC SECTION.
INTERFACES lif_partners.
ENDCLASS.
CLASS lcl_rental IMPLEMENTATION.
METHOD lif_partners~display_partner.
* just call existing method that fits
display_attributes( ).
ENDMETHOD.
ENDCLASS.

What are BADIs? What are BADI filters?

BADI Business Add Ins are enhancements to the standard version of the code of SAP.
Filter Badi- Business Add-Ins may be implemented on the basis of a filter value. If an enhancement for country-specific versions is provided for in the standard version, it is
likely that different partners will want to implement this enhancement. The individual countries can create and activate their own implementation.

How can an event be raised and handled?

Events link objects or classes more loosely than direct method calls do. Method calls establish precisely when and in which statement sequence the method is called. However,
with events, the reaction of the object to the event is triggered by the event itself. Events are most often used in GUI implementations. At the moment of implementation, a class
defines its:

Instance events (using the EVENTS statement)


Static events (using the CLASS-EVENTS statement)
Classes or their instances that receive a message when an event is triggered at runtime and want to react to this event define event handler methods.
Statement:

[CLASS-]METHODS <handler_method> FOR EVENT <event> OF <classname>.

These classes or their instances are registered to one or more events at

runtime.

Statement: SET HANDLER <handler_method> FOR <reference>. (for instance events)


SET HANDLER <handler_method>. (for static events)
A class or instance can trigger an event at runtime using the RAISE EVENT statement.

What are Exceptions? How can an Exception be raised?

1.

Exceptions that occur in procedures (methods, function modules, or subroutines) do not necessarily need to be handled there; they can be passed along to the calling program.

2.

The calling program can then handle the exception itself or also pass it along to its own caller, and so on.

3.

The highest levels to which an exception can be passed are processing blocks without local data areas - that is, event blocks or dialog modules.

4.

The exceptions passed along by the called procedures must be dealt with there, as must any exceptions raised within this processing block itself. Otherwise a runtime error
occurs.

5.

To pass along an exception from a procedure, you generally use the RAISING addition when defining the procedure interface. In methods of local classes and subroutines,
specify the RAISING addition directly when defining the procedure

(METHODS meth ...


RAISING cx_... cx_...,
FORM form ...
RAISING cx_... cx_...).
6.After RAISING, list the exception classes whose objects are to passed along.
7.In methods of global classes, the exception classes whose objects are to be propagated are entered in the exception table of the method in the Class Builder. Check
the Exception Classfield in this exception table.
8.Similarly, exceptions raised by function modules are passed along by being entered in the Function Builder. Ex.

the exception we have defined (zcx_wrong_planetype) is raised if the airplane type passed to the method get_technical_attributes is not stored in the table saplane.
Here, however, the exception is only raised in the method get_technical_attributes, not handled there.
To pass the exception along to the caller of the method, we enter it after the RAISING keyword.
Now, the caller - that is, the method display_attributes - handles the exception. For this purpose, we have implemented a TRY-ENDTRY control structure in this method. The
methodget_technical_attributes is now called in the TRY block of this control structure.

If the exception is raised in the method get_technical_attributes, the program continues by handling this exception. That is, the method get_technical_attributes is terminated
and the appropriate CATCH block is processed within the caller. Note in particular that the program no longer executes the WRITE statements entered in the TRY
block afterget_technical_attributes is called.

What are the types of Exception classes?

a. Global
b. Local Exceptions Class.

Where can a protected method be accessed?

Protected components Only visible within the class and its sub classes.

What is a signature of a method?

Methods have a parameter interface (called signature ) that enables them to receive values when they are called and pass values back to the calling program.
In ABAP Objects, methods can have IMPORTING, EXPORTING, CHANGING, and RETURNING parameters as well as exception parameters.
CLASS <classname> DEFINITION.
...
METHODS: <method_name>
[ IMPORTING <im_var> TYPE <type>
EXPORTING <ex_var> TYPE <type>
CHANGING <ch_var> TYPE <type>
RETURNING VALUE(<re_var>) TYPE <type>
EXCEPTIONS <exception>
RAISING <class_exception> ].
ENDCLASS.(signature of a method).

CLASS <classname> IMPLEMENTATION.


METHOD <method_name>.
...
ENDMETHOD.
ENDCLASS.

Syntax to find out if a reference variable is referring to an object?

CLASS lcl_vehicle DEFINITION.


PUBLIC SECTION.
...
PRIVATE SECTION.
...
ENDCLASS.
CLASS lcl_vehicle IMPLEMENTATION.
...
ENDCLASS.
DATA: r_vehicle1 TYPE REF TO lcl_vehicle,
r_vehicle2 TYPE REF TO lcl_vehilce.
START-OF_SELECTION.
..............

Explain syntax Definition Load.

CLASS CL_GUI_CFW DEFINITION LOAD.


To access the static methods of a class we define it with LOAD.
As in BADI we use the static methods of the Class which is been used in the BADI.
so we define the class using the kewowrd LOAD.

DEFERRED

CLASS lcl_event_receiver DEFINITION DEFERRED.


1. It means "load all the definition of the class lcl_event_receiver". After this statement, you can then access methods and attributes of lcl_event_receiver, even though it may be
defined considerably later in the class.
2. Definition deferred means that you can refer to objects in your program which haven't yet been defined but will be later on in your code. You could have two classes in an
abap say and data elements / types in the first class refer to the 2nd class such as obj1 type ref to zclass2 definition deferred. The zclass2 definition will appear later in your
abap.
3. If you don't put definition deferred then when you check the program it will give a syntax error of zclass2 not found.

DELEGATION

In delegation, two objects are involved in handling a request: The recipient of the request delegates the execution of the request to a delegate.

What is an alias in ABAP OOPS?

Within a class, attribute names, method names, event names, constant names, type names and alias names all share the same namespace. In ABAP Objects, the same
components can be defined in interfaces and in classes. This allows you to shift part of the public point of contact of a class into an interface, even though the class is already in
use; users will not notice the difference as long as you use alias names (see appendix) for the components that are now in the interface. To simplify accessing interface
methods you can work with alias names.
1. Alias names can only appear in the in the declaration part of a class or in the interface definition.
Example for an alias in the interface: ALIASES a1 FOR lif_interface~method1
2. An alias defined in this way can be directly addressed using r_ref->a1.

What is a Persistent Class? Explain.

To use the Persistence Service for objects, the classes of these objects must be created as persistent classes in the Class Builder. The term persistent class does not imply
that a class is persistent. (As a template for objects, every class is persistent). Rather, it means that the objects of that class and their state are managed by the Persistence
Service. For example, the objects of these classes are instantiated in the ABAP program with a method of the Persistence Service, which ensures that the initialization is correct
(not with the usual CREATE OBJECT statement). When the Class Builder creates a persistent class, it automatically generates an associated class, known as the class
actor or class agent, whose methods manage the objects of persistent classes. As well as their identity, persistent classes can contain key attributes, which allow the
Persistence Service to ensure that the content of each persistent object is unique.

What is a functional Method?

Methods that have a RETURNING parameter are described as functional methods. These methods cannot have EXPORTING or CHANGING parameters, but has many (or as
few) IMPORTING parameters and exceptions as required.
Functional methods can be used directly in various expressions:

1.

Logical expressions (IF, ELSEIF, WHILE, CHECK, WAIT)

2.

The CASE statement (CASE, WHEN)

3.

The LOOP statement

4.

Arithmetic expressions (COMPUTE)

5.

Bit expressions (COMPUTE)

6.

The MOVE statement.

Functional Method Example.


CLASS lcl_vehicle DEFINITION.
PUBLIC SECTION.
METHODS: get_average_fuel
IMPORTING im_distance TYPE s_distance,
im_fuel TYPE ty_fuel
RETURNING VALUE(re_fuel) TYPE ty_fuel,
ENDCLASS.
DATA: r_vehicle1 TYPE REF TO lcl_vehicle,
r_vehicle2 TYPE REF TO lcl_vehicle,
avg_fuel TYPE ty_fuel.
...
* example for short syntax in aritmet. operation
avg_fuel =
r_vehicle1->get_average_fuel( im_distance = 500 im_fuel = 50 )
+ r_vehicle2->get_average_fuel( im_distance = 600 im_fuel = 60 ).

What is a de-referenced variable? What is a garbage collector?

To go to an address before performing the operation a dereferenced variable is a pointer to the variable, not the variable itself. A pointer can be re-assigned any number of
times while a reference cannot be reassigned after initialization. Field symbols are similar to dereferenced pointers. Thus, you can only access the content of the data object to
which the field symbol points. (That is, field symbols use value semantics). If you want to access the content of the data object, you need to dereference the data reference first.
Example.
As soon as no more references point to an object, the Garbage Collector removes it from the memory. The Garbage Collector is a system routine that automatically deletes
objects that can no longer be addressed from the main memory and releases the memory space they occupied.
Procedure how garbage collector works..
Independent references are references that have not been defined within a class.

What is a Framework?

Automation Controller
The automation controller is the central instance at the frontend. It administers all instances of custom controls.
The Automation Controller also contains a list of the events that a custom control can trigger. All communication between the controls at the frontend and the application
program at the backend runs through the Automation Controller.
ABAP Objects Control Framework
The ABAP Objects Control Framework has a similar function at the backend to that of the
Automation Controller at the frontend. All method calls from an application program to a custom control run through the Control Framework. In order to avoid each method call
establishing a separate connection to the frontend, the method calls are buffered in the automation queue. The automation queue is not sent to the frontend until you reach a
synchronization point. Like the Automation Controller, the Control Framework has a list of control events. This list also contains the corresponding handler methods that need to
be called when the event occurs. The Control Framework also maintains a list of the control instances you have created. This list is the basis for the lifetime management of
controls.

What is a Static Constructor? What are the advantages?

1.

The static constructor is a special static method in a class with the name class_constructor.

2.

It is executed precisely once per program.

3.

The static constructor of a class <classname> is called automatically when the class is first accessed, but before any of the following actions are executed:

4.

Creating an instance in the class using CREATE OBJECT <obj>, where <obj> has the data type REF TO <classname>

5.

Addressing a static attribute using <classname>=><attribute>

6.

Calling a static attribute using CALL METHOD <classname>=><classmethod>

7.

Registering a static event handler method using SET HANDLER

<classname>=><handler_method> FOR <obj>


8. Registering an event handler method for a static event in class <classname>.
9. The static constructor cannot be called explicitly.
Advantages:

1.

For static constructors, unlike instance constructors, the static constructor in the superclass is called automatically, that is the runtime system automatically ensures that the
static constructors of all its superclasses have already been executed before the static constructor in a particular class is executed.

2.

For static constructors, unlike instance constructors, the static constructor in the superclass is called automatically, that is the runtime system automatically ensures that the
static constructors of all its superclasses have already been executed before the static constructor in a particular class is executed.

3.

the static constructor of the class creates exactly one instance of this class, which points to the attribute . This object is part of the persistence service and its methods are used
to manage the object of the persistent class.

What is Private Constructor? Limitations?

Private constructors are used to restrict the instantiation of object using 'new' operator. This type of constructors are mainly used for creating singleton object.
Limitations:

1.

A private constructor is a special instance constructor. It is commonly used in classes that contain static members only.

2.

If a class has one or more private constructors and no public constructors, then other classes (except nested classes) are not allowed to create instances of this class.

3.

An instance constructor will always run after a static constructor.

4.

Private constructors prevent a class from being explicitly instantiated by callers.

Can a class be defined without a constructor?

Yes, class can be created without any constructor. Default constructor will be created when we define a class without constructor.

What is a Friend class?

A class can provide friendship to other classes and interfaces (and hence all classes that Implement the interface).
To do this you use the FRIENDS additions to the CLASS statement, in which all classes and interfaces that are to be provided friendship are listed.
Friends are allowed to access the protected and private components of the class providing the friendship and can always create instances of this class, regardless of the
CREATE addition to the CLASS statement.
In principle, providing friendship is one-sided: A class providing friendship is not automatically a friend of its friends. If a class providing friendship wants to access the non-public
components of a friend, this friend has to explicitly provide friendship to it.
Classes that inherit from friends and interfaces that contain a friend as a component interface also become friends. Therefore, extreme caution is advised when providing
friendship. The higher up a friend is in the inheritance tree, the more subclasses can access all components of a class providing friendship. However, providing friendship, unlike
the attribute of being a friend, is not inherited.
A friend of a superclass is therefore not automatically a friend of its sub classes.

Explain syntax type table of ref to.

DATA: waitlist_buffer TYPE TABLE OF REF TO cl_taw10_waitlist,


waitlist TYPE TABLE OF REF TO cl_taw10_customer.
Example:
DATA: r_vehicle TYPE REF TO lcl_vehicle,

itab TYPE TABLE OF REF TO lcl_vehicle.


CREATE OBJECT r_vehicle.
APPEND r_vehicle TO itab.
CREATE OBJECT r_vehicle.
APPEND r_vehicle TO itab.
(2) lcl_object
(3) lcl_object
LOOP AT itab INTO r_vehicle.
* work with the current instance
ENDLOOP.
If you want to keep several objects from the same class in your program, you can define an internal table, which, for example, only consist of one column containing the object
references for this class. You can process the objects using a LOOP through the internal table.

What are RTTI classes?

RTTS (RunTime Type Services) allows to get the definition of variables or to create them during program execution. RTTS is made of 2 components:

1.

RTTI (RunTime Type Identification) is used to get the definition of existing variables or existing types

2.

RTTC (RunTime Type Creation) is used to create new variables with any definition; they must be followed by the ABAP statement CREATE DATA ... TYPE HANDLE ... to
create the variable.

Can I pass an internal table through IMPORTING parameter of a method?

Yes.

Structure of a local class definition?

Local classes are only visible in the program they were defined in.
No global access possible.
Not stored in the Repository, no where-used list, and so on.
Local classes and interfaces are only known within the program in which they are defined and implemented.
Local classes and interfaces are not stored in the Repository (no TADIR entry). There is no "global" access to these classes or interfaces (for example, from other programs).

What is MVC?

Model View Controller, is widely used in the user interface programming field and which has proved its worth, as an extension of the previous BSP implementation model. Its
controller-based use ensures an even clearer distinction between application logic and presentation logic in BSP applications. You can structure graphical user interfaces clearly
and organize them in logical units, even with complex applications.
Using the MVC design pattern has the following advantages:

Structuring BSP applications is simplified, since the view is cleanly separated from the controller and the model. This not only facilitates changing BSP applications, but

also considerably improves their maintenance.

You have the option of generating program-driven layout. The HTML/XML output is therefore created by program code instead of a page with scripting.

Navigation using the <bsp:goto> element and call using the <bsp:call> element. The advantage of using <bsp:goto> navigation over redirect is that there is no additional

network traffic. Furthermore, you remain in the same work process, which can have advantages for creating objects and memory space. The call using <bsp:call> element is
more variable than adding them using INCLUDE directive, since it is triggered at runtime.
With the call option using <bsp:call>, you can also distribute the user interface into components.

Optimized performance due to fewer redirects.

Intuitive and easy-to-use interface for application development.

S-ar putea să vă placă și