SAP ABAP Interview Article 3
How to define Selection Screen?
Ans
Parameters, Select-options & Selection-Screen
What are Check Tables and Value
Tables?
Ans
Check Table: The ABAP Dictionary allows you to define
relationships between tables using foreign keys . A dependent table is called a
foreign key table, and the referenced table is called the check table. Each key
field of the check table corresponds to a field in the foreign key table. These
fields are called foreign key fields. One of the foreign key fields is
designated as the check field for checking the validity of values. The key
fields of the check table can serve as input help for the check field.
Value
Table: Prior to Release 4.0, it was possible to use the value table of a domain
to provide input help. This is no longer possible, primarily because unexpected
results could occur if the value table had more than one key field. It was not
possible to restrict the other key fields, which meant that the environment of
the field was not considered, as is normal with check tables.
In cases
where this kind of value help was appropriate, you can reconstruct it by
creating a search help for the data elements that use the domain in question,
and using the value table as the selection method.
Check
table will be at field level checking.
Value
table will be at domain level checking ex: scarr table is check table for
carrid.
What is the difference between
tables and structures?
Ans
Tables:
1)
Data is permanently stored in tables in the database.
2)
Database tables are generated from them.
Structure:
1)
It contains data temporarily during program run-time.
2)
No Database tables are generated from it.
How to declare one internal table
without header line without using structures?
Ans
No, we cannot declare internal table without header
line and without structure because it gives error ITAB cannot be a table, a
reference, a string or contain any of these object.
Code with Header without Structure
TABLES : ZREKHA_EMP.
DATA : ITAB LIKE ZREKHA_EMP OCCURS 0 WITH HEADER LINE.
SELECT * FROM ZREKHA_EMP INTO CORRESPONDING FIELDS OF ITAB.
APPEND ITAB.
ENDSELECT.
LOOP AT ITAB.
WRITE : / ITAB-EMPNO, ITAB-EMPNAME,ITAB-DEPTNO.
ENDLOOP.
Code
without Header with Structure
TABLES : ZREKHA_EMP.
DATA :
BEGIN OF ITAB OCCURS 0,
EMPNO LIKE XREKHA_EMP-EMPNO,
EMPNAME LIKE XREKHA_EMP-EMPNAME,
DEPTNO LIKE XREKHA_EMP-DEPTNO,
END OF ITAB.
SELECT * FROM ZREKHA_EMP INTO CORRESPONDING FIELDS OF ITAB.
APPEND ITAB.
ENDSELECT.
LOOP AT ITAB.
WRITE : / ITAB-EMPNO, ITAB-EMPNAME,ITAB-DEPTNO.
ENDLOOP.
What are lock objects?
Ans
Reason for Setting Lock: Suppose a travel agent want
to book a flight. The customer wants to fly to a particular city with a certain
airline on a certain day. The booking must only be possible if there are still
free places on the flight. To avoid the possibility of overbooking, the
database entry corresponding to the flight must be locked against access from
other transactions. This ensures that one user can find out the number of free
places, make the booking, and change the number of free places without the data
being changed in the meantime by another transaction.
The R/3
System synchronizes simultaneous access of several users to the same data
records with a lock mechanism. When interactive transactions are programmed,
locks are set and released by calling function modules (see Function Modules
for Lock Requests). These function modules are automatically generated from the
definition of lock objects in the ABAP Dictionary.
Two types of Lock: Shared and Exclusive
What are datasets? What are the
different syntaxes?
Ans
The sequential files (ON APPLICATION SERVER) are
called datasets. They are used for file handling in SAP.
OPEN
DATASET [DATASET NAME]
FOR [OUTPUT / INPUT / APPENDING]
IN [BINARY / TEXT] MODE
AT POSITION [POSITION]
MESSAGE [FIELD]
READ
DATASET [DATASET NAME] INTO [FIELD]
DELETE
DATASET [DATASET NAME]
CLOSE
DATASET [DATASET NAME]
TRANSFER
[FIELD] TO [DATASET NAME]
What are the events we use in
dialog programming and explain them?
Ans
There are two events in Dialog Programming i.e.
screen:
PBO
(Process Before Output) Before the screen is displayed, the PBO event is
processed.
PAI
(Process After Input) When the user interacts with the screen, the PAI event
is processed.
POH
(Process On Help) - are triggered when the user requests field help (F1). You can
program the appropriate coding in the corresponding event blocks. At the end of
processing, the system carries on processing the current screen.
POV
(Process On Value) - are triggered when the user requests possible values help
(F4). You can program the appropriate coding in the corresponding event blocks.
At the end of processing, the system carries on processing the current screen.
What is the difference between
OPEN_FORM and CLOSE_FORM?
Ans
OPEN_FORM This module opens layout set printing. This function must be called
up before we can work with other layout set function like WRITE_FORM.
WRITE_FORM
Output text element in form window. The specified element of the layout set
window entered is output. The element must be defined in the layout set.
CLOSE_FORM
End layout set printing. Form printing started with OPEN_FORM is completed.
Possible closing operations on the form last opened are carried out. Form printing
must be completed by this function module. If this is not carried out, nothing
is printed or displayed on the screen.
What are the page windows? How many
main windows will be there in a page window?
Ans
Page Window: In this window, we define the margins for
left, width, upper and height for the layout of Header, Logo,
What are control events in a loop?
Ans
Control level processing is allowed within a
AT
<level>.
<statement block>
ENDAT.
You can
react to the following control level changes:
|
<level> |
Meaning |
|
FIRST |
First
line of the internal table |
|
LAST |
Last
line of the internal table |
|
NEW
<f> |
Beginning
of a group of lines with the same contents in the field <f> and in the
fields left of <f> |
|
END Of
<f> |
End of a
group of lines with the same contents in the field <f> and in the
fields left of <f> |
How to debugg a script?
Ans
Go to SE71, give layout set name, go to utilities
select debugger mode on.
How many maximum sessions can be
open in SAPgui?
Ans
There are maximum 6 sessions open in SAPgui.
SAP Scripts and ABAP programs are
client dependent or not? Why?
Ans
What are
System Variable?
Ans
System variables have been predefined by SAP. We can
use these variables in formulas or, for example, to pass on certain pieces of
information to a function module. How the function called by the function
module behaves depends on the type of information passed on.
At
present, we can use the following system variables:
|
System
Variable |
Use |
Meaning |
|
SY_MODE |
In
function modules |
Current
mode of the PI sheet |
|
SY_TEST |
In
function modules |
Status
of the PI sheet (test or active) |
|
SY_ROW |
In
function modules |
Current
table line |
|
SY_VALUE
or X |
Generally |
Refers
to the immediately preceding input value |
Is it compulsory to use all the
events in Reports?
Ans
What is the difference between sum
and collect?
Ans
Sum: You can only use this statement within a
If the
table contains a nested table, you cannot use the SUM statement. Neither can
you use it if you are using a field symbol instead of a work area in the
Collect:
What are session method and call
transaction method and explain about them?
Ans
Session method Use the BDC_OPEN_GROUP to create a
session. Once we have created a session, then we can insert the batch input
data into it with BDC_INSERT. Use the BDC_INSERT to add a transaction to a
batch input session. We specify the transaction that is to be started in the
call to BDC_INSERT. We must provide a BDCDATA structure that contains all the
data required to process the transaction completely. Use the BDC_CLOSE_GROUP to
close a session after we have inserted all of our batch input data into it.
Once a session is closed, it can be processed.
Call
Transaction -
In this
method, we use CALL TRANSACTION USING to run an SAP transaction. External data
does not have to be deposited in a session for later processing. Instead, the
entire batch input process takes place inline in our program.
If you have 10000 records in your
file, which method you use in BDC?
Ans
Call transaction is faster then session method. But
usually we use session method in real time...because we can transfer large
amount of data from internal table to database and if any errors in a session,
then process will not complete until session get correct.
What are different modes of Call
Transaction method and explain them?
Ans
There are three modes of Call Transaction method:
1)
A Display All Screens
2)
E Display Errors
3)
N Background Processing
What is the typical structure of an
ABAP program?
Ans
HEADER, BODY, FOOTER.
What are field symbols and field
groups? Have you used "component idx of structure" clause with field
groups?
Ans
Field Symbols They are placeholder or symbolic names for the other fields.
They do not physically reserve space for a field, but point to its contents. It
can point to any data objects.
Field-symbols <fs>
Field
Groups Field groups does not reserve storage space but contains pointers to
existing fields.
An extract
dataset consists of a sequence of records. These records may have different
structures. All records with the same structure form a record type. You must
define each record type of an extract dataset as a field group, using the
FIELD-GROUPS statement.
Field-groups <fg>
What should be the approach for
writing a BDC program?
Ans
STEP 1: CONVERTING THE LEGACY SYSTEM DATA TO A FLAT FILE
to internal table CALLED "CONVERSION".
STEP 2:
TRANSFERING THE FLAT FILE INTO SAP SYSTEM CALLED
"SAP DATA TRANSFER".
STEP 3:
DEPENDING UPON THE BDC TYPE
i) Call
transaction (Write the program explicitly)
ii) Create
sessions (sessions are created and processed. If success, data will transfer).
What is a batch input session?
Ans
BATCH INPUT SESSION is an intermediate step between internal table and database
table. Data along with the action is stored in session i.e. data for screen
fields, to which screen it is passed, program name behind it, and how next
screen is processed.
Create session BDC_OPEN_GROUP
Insert batch input BDC_INSERT
Close session BDC_CLOSE_GROUP
What is the alternative to batch
input session?
Ans
Call Transaction Method & Call Dialog
A situation: An ABAP program creates
a batch input session. We need to submit the
program and the batch session in
background. How to do it?
Ans
Go to SM36 and create background job by giving job name, job class and job
steps
(JOB
SCHEDULING)
What is the difference between a
pool table and a transparent table and how they are stored at the database
level?
Ans
Pool Table -
1)
Many to One Relationship.
2)
Table in the Dictionary has the different name, different number of fields, and
the fields have the different name as in the R3 Table definition.
3)
It can hold only pooled tables.
Transparent
Table
1)
One to One relationship.
2)
Table in the Dictionary has the same name, same number of fields, and the
fields have the same name as in the R3 Table definition.
3)
It can hold Application data.
What are the problems in processing
batch input sessions? How is batch input process different from processing on
line?
Ans
Two Problems: -
1) If the
user forgets to opt for keep session then the session will be automatically
removed from the session queue (log remains). However, if session is
processed we may delete it manually.
2) If
session processing fails, data will not be transferred to SAP database table.
Is Session Method, Asynchronous or
Synchronous?
Ans
Synchronous
What are the different types of
data dictionary objects?
Ans
Different types of data dictionary objects:
1)
Tables
2)
Views
3)
Data elements
4)
Structure
5)
Domains
6)
Search Helps
7)
Local Objects
8)
Matchcode
How many types of tables exist and
what are they in data dictionary?
Ans
4 Types of Tables:
Transparent
tables - Exists with the same structure both in dictionary as well as in
database exactly with the same data and fields. Both Open SQL and Native SQL
can be used.
Pool
tables
Cluster
tables - These are logical tables that are arranged as records of transparent
tables. One cannot use Native SQL on these tables (only Open SQL). They are not
manageable directly using database system tools.
Internal
tables
What is the step-by-step process to
create a table in data dictionary?
Ans
Steps to create a table:
Step 1:
creating domains (data type, field length, Range).
Step 2:
creating data elements (properties and type for a table field).
Step 3:
creating tables (SE11).
Can a transparent table exist in
data dictionary but not in the database physically?
Ans
No, Transparent table do exist with the same structure both in the dictionary
as well as in the database, exactly with the same data and fields.
In SAP Scripts, how will u link
FORM with the Event Driven?
Ans
In PAI, define function code and write code for the same.
Can you create a table with fields
not referring to data elements?
Ans
YES. e.g.:- ITAB LIKE SPFLI.
Here we
are refering to a data object (SPFLI) not data element.
What is the advantage of
structures? How do you use them in the ABAP programs?
Ans
GLOBAL EXISTANCE (these could be used by any other program without creating it
again).
What does an extract statement do
in the ABAP program?
Ans
Once you have declared the possible record types as field groups and defined
their structure, you can fill the extract dataset using the following
statements:
EXTRACT
<FG>.
When the
first EXTRACT statement occurs in a program, the system creates the extract
dataset and adds the first extract record to it. In each subsequent EXTRACT
statement, the new extract record is added to the dataset
EXTRACT
HEADER.
When you
extract the data, the record is filled with the current values of the
corresponding fields.
As soon as
the system has processed the first EXTRACT statement for a field group
<FG>, the structure of the corresponding extract record in the extract
dataset is fixed. You can no longer insert new fields into the field groups
<FG> and HEADER. If you try to modify one of the field groups afterwards
and use it in another EXTRACT statement, a runtime error occurs.
By
processing EXTRACT statements several times using different field groups, you
fill the extract dataset with records of different length and structure. Since
you can modify field groups dynamically up to their first usage in an EXTRACT
statement, extract datasets provide the advantage that you need not determine
the structure at the beginning of the program.
What is a collect statement? How is
it different from append?
Ans
Collect : If an entry with the same key already exists, the COLLECT statement
does not append a new line, but adds the contents of the numeric fields in the
work area to the contents of the numeric fields in the existing entry.
Append
Duplicate entries occurs.
What is OPEN SQL vs NATIVE SQL?
Ans
Open SQL These statements are a subset of standard SQL. It consists of DML
command (Select, Insert, Update, Delete). It can simplify and speed up database
access. Buffering is partly stored in the working memory and shared memory.
Data in buffer is not always up-to-date.
Native SQL They are loosely integrated into ABAP. It allows access to all
functions containing programming interface. They are not checked and converted.
They are sent directly to the database system. Programs that use Native SQL are
specific to the database system for which they were written. For e.g. to create
or change table definition in the ABAP.
What does an EXEC SQL stmt do in
ABAP? What is the disadvantage of using it?
Ans
To use a Native SQL statement, you must precede it with the EXEC SQL statement,
and follow it with the ENDEXEC statement as follows:
EXEC SQL
[PERFORMING <form>].
<Native SQL statement>
ENDEXEC.
There is
no period after Native SQL statements. Furthermore, using inverted commas
(") or an asterisk (*) at the beginning of a line in a native SQL
statement does not introduce a comment as it would in normal ABAP syntax. You
need to know whether table and field names are case-sensitive in your chosen
database.
What is the meaning of ABAP editor
integrated with ABAP data dictionary?
Ans
ABAP Editor: Tool in the ABAP Workbench in which you enter the source code of
ABAP programs and check their syntax. You can also navigate from the ABAP
Editor to the other tools in the ABAP Workbench.
What are the events in ABAP
language?
Ans
The events are as follows:
1.
Initialization
2.
At selection-screen
3.
Start-of-selection
4.
End-of-selection
5.
Top-of-page
6.
End-of-page
7.
At line-selection
8.
At user-command
9.
At PF
10. Get
11. At
New
12. At
LAST
13. AT
END
14. AT
FIRST
What is an interactive report? What
is the obvious difference of such report compared with classical type reports?
Ans
An Interactive report is a dynamic drill down report that produces the list on
users choice.
Difference:
-
a) The
list produced by classical report doesn't allow user to interact with the
system where as the list produced by interactive report allows the user to
interact with the system.
B) Once a
classical report, executed user looses control where as Interactive, user has
control.
C) In
classical report, drilling is not possible where as in interactive, drilling is
possible.
What is a drill down report?
Ans
Its an Interactive report where in the user can get more relevant data by
selecting explicitly.
How do you write a function module
in SAP? Describe.
Ans
1.
Called program - SE37 - Creating function group, function module by assigning
attributes, importing, exporting, tables, and exceptions.
2.
Calling program - SE38 - In program, click pattern and write function name-
provide export, import, tables, exception values.
What are the exceptions in function
module?
Ans
Exceptions: Our function module needs an exception that it can trigger if there
are no entries in table SPFLI that meet the selection criterion. The exception
NOT_FOUND serves this function.
COMMUNICATION_FAILURE
& SYSTEM_FAILURE
How are the date and time field
values stored in SAP?
Ans
DD.MM.YYYY. HH:MM:SS
What are the fields in a BDC_Tab
and BDCDATA Table?
Ans
Fields of BDC_Tab & BDCDATA Table:
Sr.No
Fields
- Description
1)
Program
- BDC Module pool
2)
Dynpro - BDC Screen
Number
3)
Dynbegin
- BDC Screen Start
4)
Fname
- Field Name
5)
Fval
- BDC field value
Name a few data dictionary objects?
Ans
Different types of data dictionary objects:
1)
Tables
2
Rating: 3.60