1.
Difference Between Type ,Data ,Types & Field-Symbol :
TYPE STATEMENT you can
define structure which have no physical memory.
DATA
STATEMENT you can define structure with physical memory with predefined
data objects.
TYPES describes what data should look like.
FIELD-SYMBOL are similar to dereferenced pointers in C. While using the
field-symbol, system uses the same memory allocated to that particular field in
the record instead of moving it to work area and processing. They do not physically
reserve space for a field, but point to its contents.
- Call by value and Call by Reference.
Call by reference new memory is not allocated for the value. Instead, a pointer to
the original memory location is passed. All references to the parameter are
references to the original memory location. Changes to the variable within the
subroutine update the original memory location immediately.
Example. Data
f1 value 'A'.
Perform
s1 using f1.
Write
/ f1.
Form s1 using p1.
p1 = 'X'.
Endform.
O/P X
Call By value new memory is allocated for the value. This
memory is allocated when the subroutine is called and is freed when the
subroutine returns. Therefore, references to the parameter are thus references
to a unique memory area that is known only within the subroutine; the original
memory location is separate
Example. Data
f1 value 'A'.
Perform
s1 using f1.
Write
/ f1.
Form s1 using value( p1).
p1 = 'X'.
Write p1.
Endform.
O/P X A.
- Types of Internal table.
Standard tables have an internal linear index. The
key of a standard table is always non-unique. You cannot specify a unique key.
This means that standard tables can always be filled very quickly, since the
system does not have to check whether there are already existing entries.
Sorted
tables are
always saved sorted by the key. They also have an internal index. The system
can
access records either by using the table index or the key. The response
time for key access is logarithmically proportional to the number of table
entries, since the system uses a binary search. The key of a sorted table can
be either unique or non-unique. When you define the table, you must specify
whether the key is to be UNIQUE or NON-UNIQUE.
Standard tables and sorted tables are known generically as index tables.
Hashed
Table defines
the table as one that is managed with an internal hash procedure. You can
imagine a hashed table as a set, whose elements you can address using their
unique key. Unlike standard and sorted tables, you cannot access hash tables
using an index. All entries in the table must have a unique key.
- Search
Linear search: which will search line by line.
SORT TKOMV BY KNUMV KPOSN KSCHL.
READ TABLE TKOMV WITH KEY
KNUMV = GT_VBAK-KNUMV KPOSN = GT_VBAP-POSNR KSCHL ='PR00'.
Binary
Search: which will directly go to
n1/2 record if it matches the condition then ok otherwise if the
N1/2 record is greater than the searching value it will ignores the 2nd
half of the records, again from the rest of 1st half records it will calculate
the middle record and then it will checks for the condition, in this way it
will work, it means at a single iteration it will eliminates half of the records
from the search criteria.
SORT TKOMV BY KNUMV KPOSN KSCHL.
READ TABLE TKOMV WITH KEY
KNUMV = GT_VBAK-KNUMV KPOSN = GT_VBAP-POSNR KSCHL ='PR00 line BINARY SEARCH.
5.
How
many breakpoints can be in a program?
There is no fixed Number of breakpoints that
to be kept in program but debugging screen can display only 30 breakpoints.
6.
Difference
Watch point between breakpoint ?
Breakpoint is that you
specified a point a row of program to debug.
Watch point is that you
specified a condition to debug.
7.
Types
of Tables.
Transparent
table (One to one relation) this table in data dictionary equal to one table in data base.
I.e. When u create one transparent table in
ABAP dictionary one table will be created in Database (Typically Oracle, U can
have others also) with same name (Both table and fields). Basically used to
hold application data. EG: EKKO, VBAK etc.
Pooled
table: (Many to one relationship) many
tables in ABAP dictionary equal to one table pool in database. Basically used
to hold system data and customization data. One table pool contains large
number of pooled tables having data of around 100 records each.
Cluster
tables: (Many to one relationship) many tables in ABAP dictionary equal to one
table cluster in database. Basically used to hold application data. One table
cluster contains few number of cluster tables having data of around large
quantities. (In lakhs) e.g.: CDPOS, BSEG etc.
8.
Difference
Delivery class and Data Class
Delivery
class controls the
transport of table data for installation, upgrade, client copy and when
transporting
between customer systems. The
delivery class of a table determines whether SAP or the customer is
responsible
for maintaining the data in the table. It also determines how the table behaves
in a client copy or
upgrade.
Data class determines the physical area of the database (table space) in
which the table is created.
You set the data class in the technical
settings for the table. Each data class
corresponds to a physical
area in which all the tables assigned to this data
class are stored. There are the following data classes:
9. Difference between Primary
& Secondary Index?
Primary
Index: An index used to
improve performance on the combination of columns most frequently used to
access rows in a table. The index that controls the current processing order of
a file. It maintains an index on the primary key.
Secondary
indexes are maintained by the system and are invisible
to the user. Any column(s) may be specified as a secondary index, except
columns declared using a LOB data type. Maximum
number of indexes for a table can be 9.Access using %_HINTS ORACLE ‘INDEX ("SPFLI" "SPFLI~001")'.
10. Size Category in table
defines the
expected space required for the table in the database. You can choose a size
category from 0 to 4 for your table. A certain fixed memory size in the
database, which depends on the database system used, is assigned to each
category.
- Update Function Module is used for SAP Logical Unit of Work. These
function modules are triggered when an Explicit or Implicit COMMIT WORK is
encountered.
Steps CALL
FUNCTION FM_NAME IN UPDATE TASK
TABLES
it_xvbkd = xvbkd.
Update with immediate start: These functions can be restarted by the
update task in case of errors. Set this option for high
priority functions that run in a shared (SAP LUW).
Update with immediate start, no restart: Set this option for high priority
("V1") functions that run in a shared (SAP LUW). These functions may
not be restarted by the update task
Update with delayed start: Set this option for low priority
("V2") functions that run in their own update transactions. These
functions can be restarted by the update task in case of errors.
Debugging: Switch
on the debugger....go to Settings -> Display/Change Debugger Setting in that
check the check box for 'Update Debugging'.
Background Task CALL FUNCTION FM_NAME IN Background TASK
TABLES
it_xvbkd
= xvbkd.
It will be assigned to a
separate LUW.We can see this LUW registered in t-code SM58 and execute, debug
and delete manually.
- ABAP memory and SAP memory
SAP memory is a memory area to which all main sessions within a SAP GUI
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). These parameters can be set either for a
particular user or for a particular program using the SET PARAMETER statement.
Other ABAP programs can then retrieve the set parameters using the GET
PARAMETER statement. The most frequent use of SPA/GPA parameters is to fill
input fields on screens.
ABAP memory is a memory area that all ABAP programs within the same
internal session can access using the EXPORT and IMPORT statements. Data within
this area remains intact during a whole sequence of program calls. To pass data
to a program which you are calling, the data needs to be placed in ABAP memory
before the call is made. The internal session of the called program then
replaces that of the calling program. The program called can then read from the
ABAP memory. If control is then returned to the program which made the initial
call, the same process operates in reverse.
- Events of Report
·
Initialization
·
At selection-screen
·
At selection screen on
(output, value request, help request)
·
Start of selection
·
End of selection
·
Top of page
·
End of page
- Difference between AT SELECTION-SCREEN and AT
SELECTION-SCREEN OUTPUT?
AT SELECTION-SCREEN is the PAI of the selection screen whereas AT
SELECTION-SCREEN OUTPUT is the PBO
of the selection screen.
- What is the need of END-OF-SELECTION event in
ABAP reporting?
END-OF-SELECTION event is triggered in type
executable programs once the logical database has finished reading all data and
before the list processor is started. It tells the server that all the database
reading is completed and no further reading is going to take place.
- Lock Concept
Database
Locks & SAP Locks
Lock objects are use in SAP to avoid the
inconsistency at the time of data is being insert/change into database.
SAP Provide three type of Lock objects.
Read Lock (Shared Locked) protects read access to an object. The read
lock allows other transactions read access but not write access to the
locked area of the table.
Write Lock (Exclusive lock) protects write access to an object. The write
lock allows other transactions neither read nor write access to the
locked area of the table.
Enhanced write lock
(exclusive lock without cumulating) works like a write lock except that the enhanced write lock
also protects from further accesses from the same transaction.
Mode of Locks.
Shared lock
|
S (Shared)
|
Several users (transactions) can access
locked data at the same time in display mode. A request for another shared
lock is accepted, even if it comes from another user. An exclusive lock set
on an object that already has a shared lock will be rejected.
|
Exclusive lock
|
E (Exclusive)
|
An exclusive lock protects the locked object
against all types of locks from other transactions. Only the same lock owner
can reset the lock (accumulate).
|
Exclusive but not cumulative lock
|
X (exclusive
non-cumulative)
|
Exclusive locks can be requested several
times from the same transaction and are processed successively. In contrast,
exclusive but not cumulative locks can be called only once from the same
transaction. Each further lock request will be rejected.
|
Optimistic lock
|
O (Optimistic)
|
Optimistic locks initially behave like
shared locks and can be converted into exclusive locks
|
- Views
The data of a view is derived from one or more
tables, but not stored physically. These differ in the way in which the view is
implemented and in the methods permitted for accessing the view data.
· Database
views are implemented with an equivalent view on the database. A
database view provides an application-specific view on such distributed data. Database
views implement an inner join
· Projection
Views are
used to hide fields of a table. This can minimize interfaces; for example when
you access the database, you only read and write the field contents actually
needed. A projection view contains exactly one table. You cannot define
selection conditions for projection views. It is also possible to access pooled
tables or cluster tables with a projection view.
· Help
Views The
selection method of a search help is either a table or a view. If you have to select
data from several tables for the search help, you should generally use a
database view as selection method. However, a database view always implements
an inner join. If you need a view with outer join for the data selection, you
have to use a help view as selection method.
- OOPs Concept
·
Definition of class:
A Class is a Template of objects which can
handle more than one characteristic. Classes
don’t have any data it has attributes and methods
·
Definition of Objects:
Object is a real-time entity in the world. It is the instances on classes and holds some data
·
Definition of
Association:
Relating two classes or relation between two classes is called
as Association.
·
Definition of
Aggregation
One class using the instances on other class is known as
Aggregation.
·
Definition of
Composition
when one class data is related or will affect other class
data is known as composition E.g. when one class data
is deleted the data pertaining to that in another class will be deleted.Should have relationship in such a form.
·
Definition of
Abstraction:
Extracting the essential details or data while ignoring the
unwanted data.
·
Definition of
Encapsulation:
Enclosing all parts of Abstraction in a container. It is often
know as Information Hiding Hides how information how
the implementation is done. Shows only the necessary information.
- Instance and Static
- Static Methods: these methods can be called without
creating an object for the class. These methods can be directly called
using the class name like. If u declares one attribute as a static then we
can use that attribute through class name, that attribute is independent
of that object. You declare static methods using the CLASS-METHODS
statement. That means memory allocation for the attribute is only once.
- Instance Methods: These methods can be only called using
the object of the class. If u declares one attribute as an instance then
we can use that attribute through object name, that attribute is dependent
of that object. You declare instance methods using the METHODS
statement.
- Constructor & Static-Constructor.
The
Instance constructor of a class is the predefined instance method CONSTRUCTOR.
· Constructor's signature can have only importing
parameters or exceptions.
· Instance Constructor is a special instance
method can access the Instance Variables and Static Variables. This method is used to set the default values
in a class.
The Static constructor of a
class is the predefined static method CLASS_CONSTRUCTOR.
·
The constructor's
signature cannot have importing parameters or exceptions.
·
The static constructor
is as special static method can access the static variables.
·
These are used to set
default values for the global attributes irrespective of instances
- Type of classes
·
Final
·
Static
·
Persistence
·
Abstract
·
Test Class
- Types of Methods.
·
Final
·
Static
·
Abstract
·
Instance
- Visibility in class with sequence
·
Private
·
Protected
·
Public
- Difference between static and instance
variables
Static attributes:
·
The attributes are created only once.
·
That means memory allocation for the attribute is only once.
·
We can call next time the same attribute by using object then
the same memory space is referred.
·
We can change the value in the memory.
Instance attributes:
· These attributes are created for every time.
· That means for each and every call statement, the attribute
creates a new memory location at every time.
- Exception Classes in Object Oriented
Programming
Exceptions are the errors that occur during
the execution of the program that interrupts the normal flow of control.
All exception classes
are inherited from global class CX_ROOT and the classes that are directly
inherited are
·
CX_STATIC_CHECK:
It is checked by both
the compiler and runtime system. If any exception of this category found and
not handled locally inside the procedure, it has been declared in the RAISING
clause of the procedure’s interface
TRY.
RAISE EXCEPTION TYPE Exception class name
EXPORTING msgv1 = 'For'
msgv2 = 'Handling'
msgv3 = 'Exceptions '
msgv4 = 'In
Program '.
CATCH Exception class name INTO CX_root Object.
ENDTRY.
·
CX_DYNAMIC_CHECK:
It is checked only at
runtime system. When the exceptions tries to leave a procedure that it has been
declared in RAISING class. Generally all system exceptions like
CX_SY_ZERO_DIVIDE will come under these exceptions
·
CX_NO_CHECK:
This type of exceptions
will be choose if the exception can occur almost everywhere. These exceptions
are always implicitly declared.
- Casting
·
Assigning/copying the instance
of sub class to super class instance is called Narrowing Cast.
·
Assigning/copying the instance
of super class to the sub class instance is called Widening Cast
- Deferred: Addition makes a class known provisionally in the
program.
- Can refer to a class without defining it?
Yes, by Using
Deferred keyword.
- What are logical units of work?
The main purpose of the logical unit of
work is to ensure data consistency in the R/3 systems.Two Types of LUW.
·
Database LUW is work unit consisting of database
operations (INSERT, UPDATE, MODIFY & DELETE) that it used to make the
database changes. The final database LUW of a SAP LUW is used to make the
changes to the database, the changes to the database is not made until after the
database commit. The database LUW is executed in a special kind of work process
called the update work process.
·
SAP LUW is a logical unit work that spans over
several dialog steps. Let us consider a complex R/3 transaction of n screens;
where each screen has its own DB LUW involving database operations and are
logically related to each other. It is important that the changes to the
database for this complex transaction must be made all at once or it must be
rolled back all for the data consistency; that is where the SAP LUW becomes
critical in maintaining a logical relationship between several DB LUWs (dialog
phases) & making all the changes to the database in the final DB LUW. SAP
LUW uses the bundling technique to achieve the same. There are several possibilities
of bundling technique and one of them is bundling the database changes using a
function module call in the UPDATE TASK.
- What are Concrete and Non-Concrete methods?
Abstract
Interface