You are on page 1of 30

Question 1. What Is Alv?

Answer :
ALV stands for ABAP List Viewer. ALV gives us a standard List format and user interface to
all our ABAP reports. ALV is created by a set of standard function modules provided by
SAP.
Question 2. What Are The Uses Of Alv Reports?
Answer :
o Sorting of records
o Filtering of records
o Totals and Sub-totals
o Download the report output to Excel/HTML
o Changing the order of the columns in the report
o Hide the unwanted columns from the report
Question 3. What Is Field Catalog In Sap Alv?
Answer :
o We have the following three ways to build a field catalog.
o Automatically through a Data Dictionary structure. 
o Manually in ABAP program. 
o Semi-automatically by combining the above two procedures.
o Declare an internal table of type SLIS_T_FIELDCAT_ALV.
o Call function module REUSE_ALV_FIELDCATALOG_MERGE.
Question 4. What Is Slis In Alv And Standard Type Tables Of It?
Answer :
SLIS is the type library for ALV grid.
If you'll use the ALV you have to add TYPE-POOLS : SLIS. command at the beginning of
your code. 
o  SLIS_LAYOUT_ALV,
o SLIS_T_FIELDCAT_ALV
o SLIS_T_LISTHEADER,
o SLIS_T_EVENT,
o SLIS_SELFIELD.

Question 5. How Do You Define Default Variant For Alv?


Answer :
he user can programmatically set the initial (default) variant for list display.
The default variant can be found using the function module
'REUSE_ALV_VARIANT_DEFAULT_GET'.

Question 6. What Is The Events Table In Alv?


Answer :
A list of possible events is populated into an event table (I_EVENTS) when this table is
passed from the function module REUSE_ALV_EVENT_NAMES_GET. The return table
from this function module contains all the possible events.
Question 7. What Are Layout Parameters Options Of Alv?
Answer :
Display options:
o Exceptions
o Totals
o Interaction
o Detail screen
o Display variants (only for hierarchical-sequential lists)
o Color
o Other

Question 8. What Is Sort Internal Table Options In Alv?


Answer :
This internal table has the following fields:
Sops:  Sort sequence.
Fieldname:  Internal output table field name.
Tab name : Only relevant for hierarchical-sequential lists. Name of the internal output table.
Up: 'X' = sort in ascending order.
Down: 'X' = sort in descending order.
Sub tot : 'X' = subtotal at group value change.
Group: '* ' = new page at group value change ,'UL' = underline at group value change.

Question 9. What Is The Main Function Module Of Alv Report?


Answer :
REUSE_ALV_GRID_DISPLAY
REUSE_ALV_LIST_DISPLAY
(Difference between)

Question 11. What Is A Report?


Answer :
There are 2 type of reports:
1. Interactive report
2. Classic reports
In classic reports, we can see the output in single list where as in interactive reports we can
see the output in multiple lists.

Question 12. What Are Classical Reports?


Answer :
These are the most simple reports. Programmers learn this one first. It is just an output of data
using the Write statement inside a loop.
Classical reports are normal reports. These reports are not having any sub reports. IT IS
HAVING ONLY ONE SCREEN/LIST FOR OUTPUT.
Events In Classical Reports:
INTIALIZATION: This event triggers before selection screen display.
AT-SELECTION-SCREEN: This event triggers after processing user input still selection
screen is in active mode.
START OF SELECTION: Start of selection screen triggers after processing selection
screen.
END-OF-SELECTION: It is for Logical Database Reporting.

Question 13. What Are The Interactive Reports?


Answer :
The user can Interact with the report. We can have a drill down into the report data.
We can have a basic list (number starts from 0) and 20 secondary lists (1 to 21).
Events associated with Interactive Reports are:
o AT LINE-SELECTION
o AT USER-COMMAND
o AT PF<key>
o TOP-OF-PAGE DURING LINE-SELECTION.
HIDE statement holds the data to be displayed in the secondary list.
sy-lisel : contains data of the selected line.
sy-lsind : contains the level of report (from 0 to 21)
Interactive Report Events:
AT LINE-SELECTION : This Event triggers when we double click a line on the list, when
the event is triggered a new sub list is going to be generated. Under this event what ever the
statements that are been return will be displayed on newly generated sub list.
AT PFn: For predefined function keys...
AT USER-COMMAND : It provides user functions keys.
TOP-OF-PAGE DURING LINE-SELECTION : Top of page event for secondary list.

Question 16. What Is A Table Maintenance Generator?


Answer :
To allow users to maintain table using SM30 transaction you use Table Maintenance
generator.

Question 17. What Is The Difference Between Client Dependent And Independent
Tables?
Answer :
If you have MANDT as the first field that is Client Dependant table otherwise it is not.
Usually most of the tables are client dependent. Only few like RFC Connections table
(RFCDES), Batch Jobs (TBTCO and TBTCP) are not client dependant.

Question 18. What Is The Difference Between At Selection Screen And At Selection
Screen Output?
Answer :
AT SELECTION-SCREEN OUTPUT is like Process Before Output Event. This would get
triggered before screen is displayed. This can be used to make fields invisible/visible based on
selection.
AT SELECTION-SCREEN: This would be triggered if you hit anything (Enter, Drop-
Down, Help, Execute) after the selection screen is displayed.

Question 19. What Is The Difference Between Clear, Refresh?


Answer :
CLEAR: It clears any field, structure or Header line of internal table.
REFRESH: Deletes all entries of internal table.
Question 20. In Alv's How Would You Get Default Values In The Selection Screen?
Answer :
Create a variant in the ALV Report with whatever columns you would like to see and set sort
criteria and column widths and save as a default variant.
You could get the default variant by calling FM REUSE_ALV_VARIANT_DEFAULT_GET

Question 21. What Are The Steps To Create Custom Table?


Answer :
o Create all the Domains and Data elements as needed using Txn SE11.
o Start creating the table using Tcode SE11.
o Maintain Delivery Class (A-Application Table, C-Customizing, etc)
o Enter all the fields (MANDT must be the first field) and appropriate data
elements or Built in Types for each field.
o Make sure you select the Primary Key for this table.
o Maintain the Technical Settings (Data class, Size, Buffering info)
o Create Secondary indexes as needed
o Activate the Table

Question 22. How To Set Hotspot In Alv Reports For A Field?


Answer :
In the Field Catalog table, you set the HOTSPOT property of the field to X.

Question 23. What Is Use Of Reuse_alv_fieldcatalog_merge?


Answer :
Using this function module, you can get the Field catalog for a given Internal table or DD
Structure. Once you get the Field catalog, you could change the properties of each field.

Question 25. What Is The Difference Between Select Single And Select Up To One
Row?
Answer :
SELECT SINGLE can be used if you know the full key to select a record. If you do not have
the full Key to select and you are interested in one single row, you could use SELECT UPTO
1 ROWS. If you use a SELECT SINGLE without a full key, you would get a warning
message in Extended Program checks.
If you have the full Key use SELECT SINGLE
If you do not have the full Key to select and you are interested in one single row, you could
use SELECT UPTO 1 ROWS..
Question 26. What Is The Secondary Index?
Answer :
There is an Index created by default for the Primary Key of the table and that is called
Primary Index. If you create, any other index that is called Secondary Index for that table.
Secondary Indexes are created to improve the performance of SELECT statements.

uestion 27. How To Create Secondary Index?


Answer :
Using SE11, Enter the table name and click on Change.
Click on Indexes and select fields and create a secondary index. Note: Always try to include
MANDT as the first field unless you have a reason..

Question 28. How Do You Modify A Table? (Internal table)


Answer :
You can modify a record using MODIFY statement or UPDATE Statement.

Question 29. What Is An Abap Memory And Sap Memory And How To Use Them?
Answer :
ABAP memory is a memory area that all ABAP programs within the same internal session
can access using the EXPORT and IMPORT statements.
SAP memory is a memory area to which all main sessions within a SAPgui have access. You
can use SAP memory either to pass data from one program to another within a session, or to
pass data from one session to another. Application programs that use SAP memory must do
so using SPA/GPA parameters (also known as SET/GET parameters).

The SET PARAMETER statement is generally used in the PAI event for a screen. The user will have entered
some value for a field on the screen and once you determine the correctness of that value, you can use the SET
PARAMETER ID statement in the PAI.

The GET PARAMETER ID statement is generally used in the PBO event. During the PBO, you are preparing
the screen for display to the user. Some of the fields on the screen may need to be filled with some default
values. This default value is the last correct value that has been entered for that field during the current logon
to the SAP system.

Hope that helps. Also there are other posts in this forum which address this question. Please search for them to
get more information.
Question 30. When The Top-of-page Event Does Get Triggered?
Answer :
TOP-OF-PAGE event will be triggered when the first ULINE, WRITE or SKIP statement
occurs in a program.

Question 31. What Is The Difference Between Skip And Reserve?


Answer :
SKIP provides empty space between lines, while RESERVE executes a page break on the
current page if the number of lines between current line and the page footer is less than the
number specified in RESERVE statement.

Question 32. What Is The Difference Between Skip And New-line?


Answer :
SKIP generates a blank line, while the NEW-LINE causes the control to move to next line.

Question 33. Can We Set Page Headers To Details Lists?


Answer :
Yes. Use TOP-OF-PAGE DURING LINE-SELECTION event.

Question 35. What Is The Command To Be Used To Transfer The Data From One
Internal Table To Another Internal?
Answer :
Move itab1 to itab2
We can use APPEND for copying data from one ITAB to another ITAB by keeping in a loop.
But it is not efficient. Instead we can use as follows:
ITAB1[]=ITAB2[].

Question 36. How Can Validate Input Values In Selection Screen And Which Event
Was Fired?
Answer :
At selection-screen is an event, which is used to validate the selection screen input fields, if
you want to validate the particular input field we use at selection-screen on event.
AT SELECTION-SCREEN ON event is used to validate input.

Question 37. What Is The Difference Between Data Element And Domain?
Answer :
Data element is the collection of domain with short description, whereas domain is collection
of datatype and length.
Domain contains only technical attributes (data type , size) where as Data Element contains
Technical attribute as well as Semantic attributes(Field description).

Question 38. What Is The Difference Between Internal Table With Header Line And
Without Header Line?
Answer :
Internal table with header line is nothing but work area name as well as internal table name is
same, whereas internal table without header line is nothing but work area name as well as
internal table name is different.
FOR INTERNAL TABLE WITH HEADER we need not create work area. But not advisable
because the user may get confused what is work area and what is internal table since they
both will be having same names.

Question 39. Which Is The First Event That Is Triggered In A Report?


Answer :
Load of program is the first triggering event in the classical reports, where as abaper point of
view initialization is the first triggering event.
LOAD-OF-PROGRAM which gets triggered internally in the SAP system, then the event
INITIALIZATION gets trigger.

Question 42. What Events Are Mandatory In Reports?


Answer :
Report dont need any event to execute the output.It we we put start-of-selection there is no
compulsory to use end-of-selection. End-of-selection is used when we want to execute some
output even when some exception occurs to skip start-of-selection.
There is no mandatory event in the report program. however, if we don't explicitly write any
event, system implicitly starts with start of selection event.In case of database selection, it is a
good practice of use end-of-selection event.

Question 43. What Is The Transaction Code Sm 31?


Answer :
SM31 is a new version of the t-code SM30.
SM30 - Call view maintenance & views for SAP tables.
SM31 - used for maintenance for SAP tables.

Question 44. What Are Text Elements?


Answer :
Text elements makes program easier to maintain program texts in different languages. These
are used for maintaining list headers, selection texts in programs.

Question 45. Explain Check Table And Value Table?


Answer :
o Check table works at table level and value table works at domain level.
o Check table is nothing but master table that u will create with valid set of values.
o Value table it provides the list of values and it will automatically proposed as a
check table while creating foreign key relationship.
Question 46. How Many Types Of Standard Internal Tables?
Answer :
STANDARD TABLE: The key is, by default, set to NON-UNIQUE. You may not use the
UNIQUE addition.
SORTED TABLE: Unlike standard tables, sorted table have no default setting for the
uniqueness attribute. If you do not specify either UNIQUE or NON-UNIQUE, the system
defines a generic table type, where uniqueness is irrelevant. You can use generic types to
specify the type of generic subroutine parameters.
HASHED TABLE: Hashed tables have no default setting. You must use the UNIQUE
addition with hashed tables. You may not use NON-UNIQUE.
Question 47. What Is Refreshing In Internal Table?
Answer :
'Refresh' is the keyword which clears the contents of an internal table body.
Question 48. What Is The Difference Between Collect And Sum?
Answer :
COLLECT allows you to create unique or summarized datasets. The system first tries to find
a table entry corresponding to the table key. The key values are taken either from the header
line of the internal table itab, or from the explicitly-specified work area.
If the system finds an entry, the numeric fields that are not part of the table key (see ABAP
number types) are added to the sum total of the existing entries. If it does not find an entry,
the system creates a new entry instead.
Question 49. What Are The Ways Of Creating Tables?
Answer :
There are two ways to create table
o Top-down approach
o Bottom-up approach
Question 50. What Is The Significance Of A Stacked List?
Answer :
The secondary list is also called the stacked list and it will be shown on the entire screen if we
don’t write its coordinates of the command window.
Question 51. When It’s The Right Time To Utilize The Command Get Cursor In
Interactive Lists?
Answer :
The command GET CURSOR will be utilized when the hidden information is not enough for
tracing the selected line.
Question 52. How Do We Describe Start –of-selection And End-of-selection?
Answer :
The start and the finish of the main processing logic, which is default for every ABAP/4
application; the statements from START-OF-SELECTION to END-OF-SELECTION are
executed automatically, there is no requirement for having END-OF-SELECTION. Every
procedural statement in ABAP applications are dependent by default on the START-OF-
SELECTION.
Q1. What is OOPS ABAP ?
Ans:

 Object orientation (OO), or to be more precise, object-oriented programming, is a


problem-solving method in which the software solution reflects objects in the real world.
 A comprehensive introduction to object orientation as a whole would go far beyond the
limits of this introduction to ABAP Objects. This documentation introduces a selection of terms
that are used universally in object orientation and also occur in ABAP Objects. In subsequent
sections, it goes on to discuss in more detail how these terms are used in ABAP Objects. The end
of this section contains a list of further reading, with a selection of titles about object orientation.

Q2. Is It Mandatory To Implement All Methods Of Interface In The Class


Which Includes Interface?

Ans: No it is not mandatory to implement all normal interface methods but it is


mandatory to implement all Abstract methods.

Q3. What Is An Interface In Ooabap?

Ans: Interface is class which contains methods without implementations.

Q4. Can We Instantiate The Interface?

Ans: No, we can not instantiate interface using create object keyword.

Q5.Can We Achieve Multiple Inheritance Using Interfaces?

Ans: Yes, by using interface concept in SAP ABAp, we can achieve multiple inheritance

Q6. Does Polymorphism Achieved Through Interfaces?

Ans: Yes, by using interface concept in SAP ABAP, we can polymorphism

Q7. What Is The Difference Between Abstract Class And Interface?

Ans: Abstract class is a class which contains at least one abstract method( Method
without implementation), Abstract class contains methods with implementation and
without implementation and we cannot create instance for the abstract class .
 Abstract class is mainly for inheritance .
 Interface contains methods without implementation .

Q8. What Is Alias Name In Ooabap?

Ans: Alias is an alias name for the interface method implemented in the class .

Q9. Can We Raise Events In Interface?

Ans: No, you can not raise events in interface, Because there is no Implementation for
the methods. We can create events in interfaces .

Q10. What Is A Single-ton Class?

Ans: Single-ton class is a class which allows to instantiate once only .

Q11. What Is The Difference In Attributes Defined In The Public Versus


Private Section Of A Class?

Ans: Public attributes can be accessed by class, subclasses and other classes where
as Private attributes can be accessed by class itself only.

Q12. What is the Difference between Class and Object ?

Ans: A Class is actually a blueprint or a template to create an Object. Whereas an


Object is a an actual instance of a Class. For example Employee ia a class, while John
is a real employee which is an Object of Employee Class.

Q13. How polymorphism can be implemented ?

Ans: Some examples to implement polymorphism:

 Method Overriding
 Method Overloading
 Operator Overloading

Q14. What is Inheritance ?

Ans: In OOPs terminology, inheritance is a way to form new classes using classes that
have already been defined. Inheritance is intended to help reuse existing code with little
or no modification. The new classes, known as derived classes, inherit attributes and
behavior of the pre-existing classes, which are referred to as base classes.
Q15. What is Method Overriding ?

Ans:

 Method overriding allows a subclass to override a specific implementation of a method


that is already provided by one of its super classes.
 A subclass can give its own definition of methods but need to have the same signature
as the method in its super class. This means that when overriding a method the subclass's
method has to have the same name and parameter list as the super class's overridden method.

Q16. What is Method Overloading ?

Ans: Method overloading is in a class have many methods having same name but
different parameter called overloading or static polymorphism

Q17. What is Aggregation ?

Ans: Aggregation is a special form of association. Aggregation is the composition of an


object out of a set of parts. For example, a car is an aggregation of engine, tyres,
brakes, etc.
Aggregation represents a "Has" relationship like a car has a engine.

Q18. What is object oriented programming language ?

Ans: Object oriented programming language allows concepts such as abstraction,


modularity, encapsulation, polymorphism and inheritance. Simula is the first object
oriented language. Objects are said to be the most important part of object oriented
language. Concept revolves around making simulation programs around an object.

Q19. What are the core ABAP oops concepts ?

Ans:

 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.

Q20. Definition: Polymorphism

Ans: 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.

Q21. Definition: Encapsulation

Ans:

 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 OOPS concept related to encapsulation that is less widely used but
gaining ground is abstraction.

Q22. Definition: Abstraction

Ans: 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.

Q24. What are the types of Objects and Classes ?

Ans: 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.

Q25. What are the types of classes which can be created ?

Ans: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).

Q26. What are the types of classes which can be created ?

Ans:
 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).

Q27. What is a reference variable ?

Ans: 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.

Q28. What is a reference variable ?

Ans: 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.

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

Ans:

 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.

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

Ans: A super class is a generalization of its subclasses. The subclass in turn is a


specialization of its super classes.

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

Ans: 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.
Q32. What is a Widening Cast ?

Ans: 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.

Q33. What is a singleton ?

Ans: 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.

Q34. What are the limitations of redefining a method ?

Ans: 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.

Q35. What are static components? What is a component selector ?

Ans: 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.

Q36. What are component instance ?

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

Q37. How is Encapsulation implemented in OOPs ?

Ans: 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.
Q38. What are BADIs? What are BADI filters ?

Ans: 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.

Q39. What are the types of Exception classes ?

Ans:

 Global
 Local Exceptions Class.

Q40. Where can a protected method be accessed ?

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

Q41. What is a signature of a method ?

Ans:

 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 DEFINITION. ... METHODS: [ IMPORTING TYPE EXPORTING TYPE
CHANGING TYPE RETURNING VALUE() TYPE EXCEPTIONS RAISING ]. ENDCLASS.
(signature of a method). CLASS IMPLEMENTATION. METHOD . ... ENDMETHOD.
ENDCLASS.

Q42. What is a functional Method ?

Ans: 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.

Q44. Can a class be defined without a constructor ?

Ans: Yes, class can be created without any constructor. Default constructor will be
created when we define a class without constructor.
Q45. What Is The Difference In An Instance Method And A Static Method?

Ans: Instance method is available separately in each object (instance), static method is


global and no instance is required for static method.

once .

Q46. What Is A Class In Ooabap?

Ans: Class is user defined data type which contains methods, events, attributes,
interfaces etc.

Q47. What Is The Difference Between Singleton And Static Class In Sap
Abap ?

Ans: Before going to static classes, you should understand static components.

 Static Components: Static components (static attributes, static events and static
methods) exists globally, no need to create object/instance of the class to access them, we can
access them by using static component selector => .
 Static Class: A class that only contains static components and no instance components
is referred to as a static class.
 Singleton Class: It is a class which does not allow you to create multiple instances.

Q48. Can We Make Methods Of Interface As Abstract And Final In Ooabap ?

Ans: No we can not make interface methods as abstract or final in Object Oriented
ABAP

Q49. Can We Declare Events In Interface In Ooabap ?

Ans: Yes, we can declare events in interface in Object Oriented ABAP

Q50. What Is A Singleton Class In Ooabap ?

Ans: Singleton class is a class which allows to instantiate(Create Object) only

Q51. What Is A Global Class In Sap ?

Ans: Global classes and interfaces are defined in the Class Builder (Transaction SE24)
in the ABAP Workbench.All of the ABAP programs in an R/3 System can access the
global classes
Q52. What Is A Local Class In Sap ?

Ans: Local classes are defined in an ABAP program (Transaction SE38) and can only
be used in the program in which they are defined.

Q53. What Is An Event In Ooabap ?

Ans: Event is a mechanism by which method of one class can raise method of another
class, without the hazard of instantiating that class.

Q54. How To Declare And Raise Events In Ooabap ?

Ans: We need to follow below steps when working with events in Object Oriented
ABAP:

 Define an event
 Define a method
 Link event and method and convert the method into event-handler method
 Create a triggering method which will raise the event
 Use set handler and register event handler method to a particular instance in the
program

Q55. What Is A Constructor Method In Ooabap ?

Ans:

 These are special type of methods


 constructor method is executed automatically whenever a object is created or
instantiated
 These methods are mainly used to set default values in a class
 The name of the constructor method is 'constructor'
 These methods have only importing parameters
 There are no exporting parameters

Q56. What Is Abstract Method In Ooabap ?

Ans: Abstract methods is a method which doesn't contain any implementation.

Q57. What Is An Abstract Class In Ooabap ?

Ans:

 It is a class which contains methods with implementation as well as methods without


implementation .
 Abstract class is a class which contains at least one abstract method.

Q58. Can We Instantiate Abstract Class In Ooabap ?

Ans:

 we cannot create an object to the abstract class instead create an object to the child
class and call the methods .
 Abstract class are mainly used for creating inheritance.

Q59. What Is The Use Of 'defination Deferred' Keyword In Ooabap ?

Ans: It is the keyword which indicates the class definition is delayed or postponed or
Defined at some place in program.

Syntax : CLASSÂ Â DEFINITION DEFERED.

Q60. What Are The Advantages Of Oo Alv ? (imp)

Ans: Some of the main advantages of Object Oriented ALV

 We have no of events available in the classes when compared to ALV with function
modules which gives flexibility for the programmer to develop ALV'S for various scenarios.
 We can display more than one ALV grid data on a single screen.
 The ALV grid data is displayed in the form of custom container with which we can control
the size of ALV grid Whereas we cannot control the size of the ALV with function Modules.
 We can also place different UI elements like checkbox, Radiobutton on the same screen
in addition ALV grid data.

Q61. What Are The Types Of Constructor's In Ooabap ? Explain ?

Ans: CONSTRUCTOR's are special type of methods, constructor method is executed


automatically whenever a object is created or instantiated.

 Constructor: This method is executed automatically whenever object is created, this is


used to set default values with respect to instance/object. The name of the constructor method
is CONSTRUCTOR.
 Static Constructor: This method is executed automatically whenever object is created,
this is used to set default values globally irrespective of instances/objects.The name of the static
constructor is CLASS_ CONSTRUCTOR.
Q62. What Is A Polymorphism In Ooabap ?

Ans: Polymorphism is a concept by which the same method names will behave


differently in different classes i.e each method will have it's own implementation in
different classes but with the same name.

Q63. Can We Defined A Class Without A Constructor In Ooabap ?

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

Q64. What Is A Friend Class?

Ans: Friend class is a class it can access private components of it’s friends class.

Q65. What Is Alias?

Ans: Instead of specifying full name of interface methods, we can assign it a


name which can directly trigger.

Q66. What Is Me Variable?

Ans: It just like a selfreference, by this we can call methods that are with in same
class with out creating object.

Q67. How To A Create Object For The Class?

Ans:

Data: ref type ref to .


Create object ref.

Q68. How To Call A Method?

Ans: Call method ref>method_name .

Q69. What Are The Differences Local & Global Classes?

Ans:
 Local classes are defined locally with in a program and the other programs can’t access
the same classes directly.
 But global classes are not like that they are globally accessible from ABAP environment.
 Global classes are centrally defined in a repository. Transaction code for global classes
is SE24(class builder).

Q70. What Is The Difference Between Function Group And Classes?

Ans: We can create many instances of the same class with in a program, but we cannot
create many instances of function group.

Q71. How Many Types Of Classes Are There In Ooabap?

Ans:

 Public class
 Private class
 Final class
 Singleton class
 Abstract class
 Persistent class
 Friend class

Q72. How To Define A Class Locally?

Ans:

class <cl_name> definition.


Public section.
Methods: m1 importing p1 type
Exporting p2 type
Changing p3 type
Returning p4 type
Exceptions
Protected section
Private section
Endclass
Class <c1_name> implementation.
Method m1.
Endmethod.
Endclass
Q73. How To Create An Object For Private Class?

Ans: In general we can not create object for a private class, but we can access
static method of a private class so call that method using its class name and import
that object.

For example take one static method with an exporting parameter inside private class
and write object creation code in that static method and export that object.

Difference  OO-ALV and ALV with Function modules are:

1. We have n number of events availabel in the classes when compared to ALV with function
modules.

2. We can display more than one ALV grid data on a single screen in OO-ALV. But in normal
ALV it is not possible.

3. We can control the size of ALV grid through custome container. we can not control the size of
the ALV with function modules.

4. we can place different UI elements(check box, radio button, drop down...) with OO-ALV but
we can't through ALV with function modules.

5. In OO-ALV using object oriented methods and classes(data secure), but normal ALV using
function modules

EVENT:-
Flow of event;
Load-of-Program
Initialization
At Selection-Screen
At Selection-Screen on <field(mention the field name)>
At Selection-Screen on block
At Selection-Screen output
start-of-selection
top-of-page
end-of-selection.
end-of-page.
At Pf<nn>
At Line-Selection
At User-Command
Top-of-Page during line-selection

what is the event that will be triggered first in an ABAP report?.


Ans:-
Initialization event is triggered first if user executes an ABAP report. But if the program is of
type 1, M, F, or S; then LOAD-OF-PROGRAM is triggered first and then INITIALIZATION
event.
Smartforms:

Q1. What is SAP Smartform?

Ans: Smart Forms are printing forms used to print Invoice and purchase order forms
etc. We are calling smartforms from  ABAP programs then spools are generated, now
smartform ready to be printed.

SMARTFORMS is the transaction to design the smart form layout.

SMARTSTYLES are used to define paragraph and character formats (fonts, barcodes,
etc.)

Q2. I have a smartform which works fine in development server. After


trasnsporting it to Production, there is no Function module generated for
this smartform. Due to that  my program dumps in Production? How to solve
this?

Ans: The Smartform that is created in the Development may not have the same name
in the Production server. So it is always advised to use the Function Module
SSF_FUNCTION_MODULE_NAME to get the Function Module name by passing the
Smartform name.

DATA: fm_name TYPE rs38l_fnam.

CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'


EXPORTING

formname = 'ZSMARTFORM'

IMPORTING

fm_name = fm_name

EXCEPTIONS

no_form = 1

no_function_module = 2

CALL FUNCTION fm_name

EXCEPTIONS

formatting_error = 1

internal_error = 2

send_error = 3

ENDIF.

Q3. How can you make the Smartforms to choose a printer name by default?

Ans: In the CALL FUNCTION of the Smartform Function Module, set the output options
parameter to set the printer name.

The output options is of the type SSFCOMPOP which contains the field TDDEST. Set
the TDDEST field to your default printer name. 

Q4. Where can I provide the input parameters to the smartform?

Ans: The input parameters for the smartform can be defined in Global Settings->Form
Interface.
The Associated Type must be defined in the ABAP Dictionary.

Q5. Where do you Configure the Adobe Forms / Smart forms / SAP Script to
the output type in NACE?

Ans: Go to transaction NACE.

Choose the required application from the list and click on output types.

Chose one of the Output types from the right pane and click on processing routines.

If an SAP Script to be attached, fill-in the driver program name, Form routine and SAP
Script name in the field “Form” (shown below)”

If an Smart Form / Adobe Form are to be attached, enter the form name in the field
“PDF/SmartForm Form” and select one of the types “PDF” or “SmartForm”. (See the
screenshot below)

Q6. How can I insert symbols in Smartforms?

Ans: Select the Text node.

Change Editor

Go to menu Include->Characters->SAP Symbols

Choose the SAP symbol that you want to insert.

Q7. Where can I define my own global types for the smartform?

Ans: The global types can be defined in Global Settings->Global Definitions->Types

The types defined here will be global through the entire smartform.

Also the form routines can be defined Global Settings->Global Definitions->Form


Routines
Q8. I have defined my own Program Lines, where I have used a global
variable G_TEXT. I get an error G_TEXT is not defined?

Ans: Whenever using the global variables in the Program Lines, enter the variable
name in Input Parameters if you are going to use(read) the variable. If you are going to
both read/write the variable value enter the same in Output Parameters.

Q9. I have created a table node for display. Where can I check the condition
which must satisfy to display the table?

Ans: The conditions can be defined in the Conditions tab. In smartforms all the nodes
have a condition tab where you can specify the condition to be satisfied to access the
node.

Q10. How can I define Page Protect in Smartforms?

Ans: To define Page Protect for a node go to the Output options and check the Page
Protection checkbox.

Q12. How do you convert a Smartform Output to PDF output?

Ans: The following two function modules and their importing/exporting parameters:

CONVERT_OTF

CONVERT_OTF_2_PDF

In the Driver program, import the parameter 'job_output_info' from the Smartform FM
and utilize that info in 'OTF' parameter of the two aforementioned function modules.

Q13. How can you see the Smartform Print Preview output as list output?

Ans: Type SLIS in the command prompt and hit enter. 

Q14. How do you achieve Bar Code printing in Smartforms?

Ans:

Step1: Use SE73 i.e. SAP-Script Font Maintenance and create a Bar code say
Zbarcode.
Step 2: For Smartform, create a character format C1 and use the recently created
Barcode Zbarcode.

Q15. How do you add a Watermark Or a Background Image for Smartforms ?

Ans: If you go to the properties of a page in Smartform, you will find a tab for
Background Image.

Specify the source of the image you need here and it can be used as background image
/ Watermark in Smartforms.

Graphics can be maintained using T.code SE78.

Background Image for Smartforms. 

Q16. How will you print on both sided of a Smartform?

Ans: At the Page level in Smartforms, you can find something called as Print Mode.

Set the Print mode to duplex to print on both sides of the Smartform.

Q17. How can you  provide a background color to the table?

Ans: In the Table Painter, you can specify the color and shading for the table lines. 

Q18. How can you make the Smartforms to display a print preview by default
without displaying the popup for print parameters?

Ans: In the SSF_OPEN function module,

Set the OUTPUT OPTIONS paramter TDDEST to your printer name.

Set the CONTROL PARAMETERS and control parameters as shown below,

control-preview = 'X'.

control-no_open = 'X'.

control-no_close = 'X'.
control-no_dialog = 'X'.

control-device = 'PRINTER'.

control_parameters-no_dialog = 'X'.

control_parameters-no_open = 'X'.

control_parameters-no_close = 'X'.

OUTPUT_OPTIONS-TDDEST = 'PRINTER NAME'.

OUTPUT_OPTIONS-TDNOPRINT = 'X'.

CALL FUNCTION 'SSF_OPEN'

EXPORTING

output_options = output_options

control_parameters = control

user_settings = ' '

EXCEPTIONS

formatting_error = 1

internal_error = 2

send_error = 3

user_canceled = 4

OTHERS = 5. 
Q19. What is the difference in a Table and a Template in Smartform?

Ans: A Template has fixed number of Rows and Columns whereas a Table can have
variable rows and columns .

We should use a template when the tabular output is fixed!

Q20. How do you achieve Page Protection in Smartform ?

Ans: While one can use the PROTECT ..... ENDPROTECT command for SAP-Scripts,
for Smartforms the Page-Protection checkbox can be used to ensure page protection:

Page Protection in Smartforms

Q21. Can you move a Smartform from one SAP system to another without
using transports ?

Ans: Yes, this can be achieved using the Upload/Download feature for Smartforms.

One can download the Smartform from one system and save it as an XML file.

Once that is done, the XML file can be used to upload the Smartform in another system.

Q22. Can you have a Smartform without a main window?

Ans: Yes, you can create a Smartform without a Main Window. But there is no need to
do anything of such sort.

Q23. How do you find the name of the Function Module for a Smartform?

Ans: The function module for Smartform is created when the Smartform is activated.

You can find the name of the Function Module for a Smartform by going to

Environment --> Function Module Name.


Q24. What is a Copies Window?

Ans: We use the copies window to define an output area for the print output, whose
content you want to appear either only on the copy or only on the original. This allows
you to flag copies as copies when the form is printed.

You can determine where to print the inferior nodes of a copies window:

Both on the original and on the copies ( Original and Copies )

Only on the original ( Only Original )

Only on the copies ( Only Copies )

You can use the system fields SFSY-COPYCOUNT or SFSY-COPYCOUNT0 to query


whether the current output is the original or, respectively, which number the copy has.

Q25. What is a Final Window?

Ans: Final Window is called after all the other windows are called in a Smartform. 

Q27. What is PROTECT & ENDPROTECT?

Ans: PROTECT & ENDPROTECT is a command used to protect a paragraph against a


page break.

Q30. How can you display the total number of pages in Smartforms?

Ans: Use SFSY-FORMPAGES to display the total number of pages in the Smartforms

&SFSY-PAGE& Current page number

&SFSY-FORMPAGE& Total number of pages in the currently formatted layout set

&SFSY-JOBPAGE& Total number of pages in the currently formatted print request

&SFSY-COPYCOUNT& Original-1,1st copy-2

&SFSY-DATE& Date
&SFSY-TIME& Time

&SFSY-USERNAME& Username.

Q31. How to Debug a SAP Smartform?

Ans: To debug a smartform in quality or testing system, go to tcode SMARTFORMS.


Enter the name of the smartform if you know or find the name of the smartform name
from NACE and display the smartform.debug-smartforms-1Find the statement in the
smartform where you want to place the break-point.debug-smartforms-2Go to menu
Environment –> Function Module Name to get the name of the function module for the
Smartform.debug-smartforms-3Copy the function module name in the popup. debug-
smartforms-4Go to tcode SE37 (Function Builder).debug-smartforms-5Enter the name
of the function module and go to Menu Goto –> Main Program.debug-smartforms-6In
the Main Program click on FIND to search the statement where you want to place the
break-point.debug-smartforms-7Enter the text of the line where you want to place the
break-point in the FIND popup.debug-smartforms-8Place the break-point on the desired
line.debug-smartforms-9Now run the driver program, the control stops at the break-point
and you can analyze the smartform.

Q32. What are important trnsacodes used for smartforms?


Ans:

 SMARTFORMS - SAP Smart Forms Basis


 SMARTSTYLES - SAP Smart Styles Basis

You might also like