You are on page 1of 96

BADI:

BADI is just an object-oriented version of user-exit. Instead


of entering program code into some function module (as in
customer-exit), you define some class which has to
implement predefined methods and those methods are
fired at predefined points just like an old user-exit. Some
BADI can have multiple independent implementations
which is much better for software deployment as several
developers can implement the same BADI independently.
Find a BADI :
1. Go to the TCode SE24 and enter CL_EXITHANDLER as
object type.
2. In 'Display' mode, go to 'Methods' tab.
3. Double click the method 'Get Instance' to display it
source code.
4. Set a breakpoint on 'CALL METHOD
cl_exithandler=>get_class_name_by_interface'.
5. Then run your transaction.
6. The screen will stop at this method.
7. Check the value of parameter 'EXIT_NAME'. It will
show you the BADI for that transaction.
How to create table maintenance?
Purpose of TMG?
Ans: This is used to create a maintenance view for the
table .. Thru which
U can enter values in table from SM30.
(Default auth group: &NC& means "Not Classified"
The ONLY purpose for SAP Authorisation Groups for tables
is to limit access in S_TABU_DIS

So do not listen to horror stories and assign or reassign


the authorisation groups to tables as you like and control
table access that way in your roles!

There is only one rule in this part of the Game never give
access to &NC&
)

What is one step and two step maintenance means?


Ans: one step: Only overview screen is created i.e. the
Table Maintenance Program will have only one screen
where you can add, delete or edit records.

Two step: Two screens namely the overview screen and


Single screen are created. The user can see the key fields
in the first screen and can further go on to edit further
details.
What is syntax of at_selection_sreen and
at_selection_sreen_output?
Ans: SELECTION-SCREEN BEGIN OF BLOCK b1 WITH
FRAME TITLE text-001.
PARAMETER : p_werks LIKE marc-werks MODIF ID s1.
SELECT-OPTIONS : s_ebeln FOR ekko-ebeln NO INTERVALS
MODIF ID s2.
SELECTION-SCREEN END OF BLOCK b1.
SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME
TITLE text-004.
SELECTION-SCREEN BEGIN OF LINE.
*********INITIALIZATION OF SELECTION SCREEN
ELEMENTS.*****
INITIALIZATION.
p_werks = '1000'.
s_ebeln-low = '4500016926'.
s_ebeln-option = 'EQ'.
s_ebeln-sign = 'I'.
APPEND s_ebeln.
CLEAR s_ebeln.
***********SCREEN MODIFICATIONS*******************

AT SELECTION-SCREEN OUTPUT u can make a few fields


visible, few ready for input and few not... like that.
AT SELECTION-SCREEN OUTPUT.
LOOP AT SCREEN.
IF r1 EQ 'X' AND screen-group1 EQ 'S2'.
screen-input = 0.
MODIFY SCREEN.
ENDIF.
IF r2 EQ 'X' AND screen-group1 EQ 'S1'.
screen-input = 0.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
AT SELECTION-SCREEN.
IF sy-dynnr = '0500'.
IF s_conn IS INITIAL.
MESSAGE 'Please enter values' TYPE 'W'.
ELSE.
SELECT *
FROM sflight
INTO TABLE sflight_tab
WHERE carrid = p_carrid AND
connid IN s_conn.
IF sy-subrc <> 0.
MESSAGE 'No flights found' TYPE 'E'.
ENDIF.
ENDIF.

What is syntax of PBO and PAI module declaration?


ANS: PROCESS BEFORE OUTPUT.
MODULE STATUS_0100. -> double click

PROCESS AFTER INPUT.


MODULE USER_COMMAND_0100. -> double click

What is PBO and PAI?


The screen flow logic is divided into four components:

Process Before Output (PBO) event:


which is processed before the screen is displayed

Process After Input (PAI) event:


Which is processed after a user action on the screen

Process on help request (POH)


which is processed when F1 is pressed

Process on value request (POV)


which is processed when F4 is pressed
What is loop_at_screen?
Whats the difference between set screen and call
screen?
Ans: CALL SCREEN nnnn interrupts the current screen,
inserting screen nnnn and any of its subsequent screens.
SET SCREEN <next screen>.

This statement defines a new next screen for the current


program run. You can also specify the number of the next
screen as a field containing a screen number. The

statically-defined next screen is ignored. However, this


only overrides the static screen sequence temporarily. The
static value for the next screen, as defined in the Screen
Painter, is always retained.

Events:
Classical Reports generates the Basic List and
Interactive reports generates the Up to 20 Secondary
Lists.
Initialization: is the event to get assign the value as a
default(nothing but the initialization of the variable).
It is the first event to trigger but if your program
contains parameters or Select Options it trigger but
not show the output on the list.
For parameters you can assign values to them in
their declaration. But you cannot do this for selectoptions.
e.g 1. PARAMETERS datum TYPE sy-datum
DEFAULT sy-datum.
2. INITIALIZATION.
S_MATNR-OPTION = 'EQ'.
S_MATNR-SIGN

= 'I'

S_MATNR-LOW

= '1

'APPEND S_MATNR.
3.

SELECTION-SCREEN BEGIN OF BLOCK B1.


SELECT-OPTIONS : SO_PDATE FOR CDHDR-UDATE.
SELECTION-SCREEN END OF BLOCK B1.

INITIALIZATION.
so_pdate-low = sy-datum.
append so_pdate.

Top-of-page: is the event to design the header of the


list. It is the only the event trigger after the
initialization. First the control goes to Start-ofselection and then system(driver program ) searches
for the Top-of-page event if it has declared,
immediately control goes to that event and print the
data whatever you given under that event.

Start-of-Selection: is the event to picking up the data


from the database and for generating the Basic list
data. It triggers after the top-of-page event. By
defualt system declares this event, if you forget to
declare in your report.

End-of-Selection: is the event that let to know the


system program has just completed the execution of
the Start-of-Selection event. it triggers after the
Start-of-selection event.
End-of-page: is the event to display the Total
Calculations or Page No.s and Footer Headings.
At PF: is the event to generate the GUIs(Graphical
User Interface) like tool bars, application bar, title
bar, Menu bar etc.,

At User-Command: used for generates the Push


Buttons , Command Buttons etc., These events will
trigger when the user perform some actions like
pressing the command button .

At Line-Selection: is the event to generates the


Secondary Lists, it will trigger when the user double
click or press F2 key on the list contents. for
generating the Secondary list sap provided
predefined statements: SY-LIST,SY-LILLY,etc.,for entire
record ,if you double click anywhere on the record it
generates same secondary list. if you want to
generate the secondary list based on the field you
can go for GET CURSOR FIELD fieldname VALUE field
value.

Top-of-page During Line-Selection: is the event to


generate the Headers during on the Secondary List.
You can generate different page headers for
secondary lists.

at pF<key> : function key from F5 to F12 to perform


interactive action on the list.

AT SELECTION SCREEN:
when user enters the values in the fields of the
selection screen and clicks on execution button,this
event gets triggered.this event is basically for checking
the value entered by the user for the field of the
selection screen i.e data validity checking.this event is
for entire selection screen.

AT SELECTION-SCREEN OUTPUT :
This is used for the dynamic field validation
like if u dont want a field in selection screen to be an
input field. event is triggered. allows you to modify the
selection screen directly before it is
displayed.Therefore, this event is not suitable for
setting selection screen default values

Field Catalog:
Field catalog is a format description of the display area.
The field catalog contains more than 60 fields, some of
which are only used internally. The field catalog is defined
in the Data Dictionary through table type LVC_T_FCAT.

e.g
fieldcatalog-fieldname

= 'MATNR'.

fieldcatalog-seltext_m

= 'Material Number'.

fieldcatalog-col_pos

= 4.

fieldcatalog-outputlen = 10.
Workflow:
Workflow, as the name suggests, means flow of work, may
be from one person
to another person. It is in fact a sequence of connected
activities resulting in
exchange of information.
The workflow definition is the set of rules that determine
the path that the process
takes.

For example, how a purchase requisition is processed,


from the initial request to
the creation of the purchase order
A Workflow Instance, which is often simply referred to as
the workflow, is a
single workflow run.
The workflow ensures that the right work is sent to
the right person at the right time in the right
sequence with the right information
T-CODE

DESCRIPTION

SWDD

Workflow builder

PFAC

Rule Maintainance

PFTC

Task Maintainance

SWIA

Selectiom report for workflows (display)

SWI1

Selection report for workflows(administration)

SWEL

Display workflow event log

SWO1

BOR

SWUD

Workflow diagnostic tool

SWUE

Trigger event

SWUI

Start workflows

SWUS

Start tasks

SBWP

Business Workplace

JlR is a vehicle manufacturing company and has


implemented SAP with FI, CO, SD, MM, VMS, PS and
Warranty modules. I have been part of this
implementation and have successfully shared go live of 3
implementations. Currently supporting the
implementations and now looking forward for the new
implementation opportunity.
Difference between SMOD and CMOD
When SAP Applications introduce enhancement
provisions, they need to announce them to their users,
so that users get to know about these provisions.
Transaction SMOD is used to achieve exactly this task.
These enhancements and their corresponding
components can be accesses thru SMOD (SAP
modification)tcode.
Once you know the user exit that needs to be changed
from SMOD tcode, you make changes in the appropriate
user exit and attach it to the project and activate it. This
is done thru CMOD (Customer modification) tcode.
To sum it, you first look into SMOD to get user exit name
and then use CMOD to assign that user exit to project
created by you.

A customer exit (referred as Enhancement in SMOD &


CMOD) is comprised of Function module exits, Menu
exits and Screen exits, through which it makes various
enhancement provisions for users. In transaction SMOD
& CMOD, these are referred as Components of
Enhancement.

Link: http://www.saptraininghouse.com/2012/customerexits-in-sap-sap-transactions-smod-cmod/

Data Dictionary - FAQs

1. What are the layers of data description in


R/3?
The external layer.
The ABAP/4 layer.
The database layer.
2. Define external layer?
The external layer is the plane at which the user sees and
interacts with the data, that is, the data format in the user
interface. This data format is independent of the database
system used.
3. Define ABAP/4 layer?
The ABAP/4 layer describes the data formats used by the
ABAP/4 processor.
4. Define Database layer?
The database layer describes the data formats used in the
database.
5. What is a Data Class?
The Data class determines in which table space the table
is stored when it is created in the database.
6. What is a Size Category?
The Size category describes the probable space
requirement of the table in the database.

7. How many types of size categories and data


classes are there?
There are five Nine size categories (0-9) and 11 data
classes only three of which are appropriate for application
tables:
APPL0- Master data (data frequently accessed but rarely
updated).
APPL1- Transaction data (data that I;s changed
frequently).
APPL2- Organizational data (customizing data that is
entered when system is configured and then rarely
changed).
The other two types are:
USR
USR1 - Intended for customer's own developments.
8. What are control tables?
The values specified for the size category and data class
are mapped to database-specific values via control tables.
9. What is the function of the transport system and
workbench organizer?
The function of the transport system and the Workbench
Organizer is to manage any changes made to objects of
the ABAP/4 Development Workbench and to transport
these changes between different SAP systems.
10. What is a table pool?
A table pool (or pool) is used to combine several logical
tables in the ABAP/4 Dictionary. The definition of a pool
consists of at least two key fields and a long argument
field (VARDATA).
11. What are pooled tables?
These are logical tables, which must be assigned to a
table pool when they are defined. Pooled tables can be
used to store control data (such as screen sequences or
program parameters).
12. What is a table cluster?
A table cluster combines several logical tables in the
ABAP/4 Dictionary. Several logical rows from different
cluster tables are brought together in a single physical

record. The records from the cluster tables assigned to a


cluster are thus stored in a single common table in the
database.
13. How can we access the correction and transport
system?
Each time you create a new object or change an existing
object in the ABAP/4 Dictionary, you branch automatically
to the Workbench Organizer or correction and transport
system.
14. Which objects are independent transport
objects?
Domains, Data elements, Tables, Technical settings for
tables, Secondary indexes for transparent tables,
Structures, Views, Matchcode objects, Matchcode Ids, Lock
objects.
15. How is conversion of data types done between
ABAP/4 & DB layer?
Conversion between ABAP/4 data types and the database
layer is done within the database interface.
16. How is conversion of data types done between
ABAP/4 & external level?
Conversion between the external layer and the ABAP/4
layer is done in the SAP dialog manager DYNP.
17. What are the Data types of the external layer?
ACCP, Char, CLNT, CUKY, CURR, DATS, DESC, FLTP, INT1,
INT2, INT4, LANG, LCHR, LRAW, NUMC, PREC, QUAN, RAW,
TIMS, UNIT,VARC.
18. What are the Data types of the ABAP/4 layer?
Possible ABAP/4 data types:
C: Character.
D: Date, format YYYYMMDD.
F: Floating-point number in DOUBLE PRECISION (8 bytes).
I: Integer.
N: Numerical character string of arbitrary length.
P: Amount of counter field (packed; implementation
depends on h/w platform).
S: Time Stamp YYYYMMDDHHMMSS.

V: Character string of variable length, length is given in


the first two bytes.
X: Hexadecimal (binary) storage.
19. How can we set the table spaces and extent
sizes?
You can specify the extent sizes and the table space
(physical storage area in the database) in which a
transparent table is to be stored by setting the size
category and data class.
20. What is the function of the correction system?
The correction system manages changes to internal
system components. Such as objects of the ABAP/4
Dictionary.
21. What are local objects?
Local objects (Dev class$TMP) are independent of
correction and transport system.
22. What is a Development class?
Related objects from the ABAP/4 repository are assigned
to the same development class. This enables you to
correct and transport related objects as a unit.
23. What is a data dictionary?
Data Dictionary is a central source of data in a data
management system. Its main function is to support the
creation and management of data definitions. It has
details about
What data is contained?
A data dictionary contains a list of all files in the
database, the number of records in each file, and the
names and types of each field.
What are the attributes of the data?
an attribute may describe a component of
the database, such as a table or a field
24. What functions does a data dictionary perform?
In a data management system, the principal functions

performed by the data dictionary are


Management of data definitions.
Provision of information for evaluation.
Support for s/w development.
Support form documentation.
Ensuring that the data definitions are flexible and up-todate.
25. What are the features of ABAP/4 Dictionary?
The most important features are:
Integrated to aABAP/4 Development Workbench.
Active in the runtime environment.
26. What are the uses of the information in the
Data dictionary?
The following information is directly taken from the Data
dictionary:
Information on fields displayed with F1 help.
Possible entries for fields displayed with F4 help.
Matchcode and help views search utilities.
27. What are the basic objects of the data
dictionary?
Tables
Domains
Data elements
Structures
Foreign Keys
28. What are the aggregate objects in the data
dictionary?
Views
Match codes
Lock objects.
29. In the ABAP/4 Dictionary Tables can be defined
independent of the underlying database (T/F).
True.
30. ABAP/4 Dictionary contains the Logical
definition of the table.
31. A field containing currency amounts (data type
CURR) must be assigned to a reference table and a

reference field. Explain.


As a reference table, a system containing all the valid
currencies is assigned or any other table, which contains a
field with the currency key format. This field is called as
reference field. The assignment of the field containing
currency amounts to the reference field is made at
runtime. The value in the reference field determines the
currency of the amount.
32. A field containing quantity amounts (data type
QUAN) must be assigned to a reference table and a
reference field. Explain?
As a reference table, a system table containing all the
valid quantity units is assigned or any other table, which
contains a field with the format or quantity units (data
type UNIT). This field is called as reference field.
The assignment of the field containing quantity amounts
to the reference field is made at runtime. The value in the
reference field determines the quantity unit of the
amount.
33. What is the significance of Technical settings
(specified while creating a table in the data
dictionary)?
By specifying technical settings we can control how
database tables are created in the database. The technical
settings allows us to
Optimize storage space requirements.
Table access behavior.
Buffering required.
Changes to entries logged.
34. What is a Table attribute?
The table's attributes determine who is responsible for
maintaining a table and which types of access are allowed
for the table. The most important table attributes are:
Delivery class.
Table maintenance allowed.
Activation type.
35. What is the significance of Delivery Class?

The delivery class controls the degree to which the SAP


or the customer is responsible for table maintenance.
Whether SAP provides the table with or without
contents.
Determines the table type.
Determines how the table behaves when it is first
installed, at upgrade, when it is transported, and when a
client copy is performed.
36. What is the max. no. Of structures that can be
included in a table or structure.
Nine.
37. What are two methods of modifying SAP
standard tables?
Append Structures and
Customizing Includes.
38. What is the difference between a Substructure
and an Append Structure?
In case of a substructure, the reference originates in the
table itself, in the form of a statement include....
In case of an append structure, the table itself remains
unchanged and the reference originates in the append
structure.
39. To how many tables can an append structure be
assigned.
One.
40. If a table that is to be extended contains a long
field, we cannot use append structures why?
Long fields in a table must always be located in the end,
as the last field of the table. If a table has an append
structure the append line must also be on the last field of
the table.
41. Can we include customizing include or an
append structure with Pooled or Cluster tables?
No.
42. What are the two ways for restricting the value range
for a domain?

By specifying fixed values.


By stipulating a value table.
43. Structures can contain data only during the
runtime of a program (T/F)
True.
44. What are the aggregate objects in the
Dictionary?
Views
Match Code.
Lock Object.
45. What are base tables of an aggregate object?
The tables making up an aggregate object (primary and
secondary) are called aggregate object.
46. The data of a view is not physically stored, but
derived from one or more tables (t/f)
True.
47. What are the 2 other types of Views, which are
not allowed in Release 3.0?
Structure Views.
Entity Views.
48. What is a Match Code?
Match code is a tool to help us to search for data records
in the system. Match Codes are an efficient and userfriendly search aid where key of a record is unknown.
49. What are the two levels in defining a Match
Code?
Match Code Object.
Match CodeId.
*50. What is the max no of match code Id's that can be
defined for one Match code object?*
A match code Id is a one character ID that can be a letter
or a number.
*51. Can we define our own Match Code ID's for SAP
Matchcodes?*

Yes, the number 0 to 9 are reserved for us to create our


own Match Code Ids for a SAP defined Matchcode object.
53. Can matchcode object contain Ids with different
update types?
Yes.
54. What are the update types possible?
The following update types are possible:
Update type A: The matchcode data is updated
asynchronously to database changes.
Update type S: The matchcode data is updated
synchronously to database changes.
Update type P: The matchcode data is updated by the
application program.
Update type I: Access to the matchcode data is
managed using a database view.
Update type L: Access to the matchcode is achieved by
calling a function module.
56. What are the differences between a Database
index and a match code?
Match code can contain fields from several tables
whereas an index can contain fields from only one table.
Match code objects can be built on transparent tables
and pooled and cluster tables.
57. What is the function of a Domain?
A domain describes the technical settings of a table
field.
A domain defines a value range, which sets the
permissible data values for the fields, which refers to this
domain.
A single domain can be used as basis for any number of
fields that are identical in structure.
58. Can you delete a domain, which is being used
by data elements?
No.
59. What are conversion routines?
Non-standard conversions from display format to sap
internal format and vice-versa are implemented with so
called conversion routines.

60. What is the function of a data element?


A data element describes the role played by a domain in a
technical context. A data element contains semantic
information.
61. Can a domain, assigned to a data element be
changed?
Yes. We can do so by just overwriting the entry in the field
domain.
62. Can you delete data element, which is being
used by table fields.
No.
63. Can you define a field without a data element?
Yes. If you want to specify no data element and therefore
no domain for a field, you can enter data type and field
length and a short text directly in the table maintenance.
64. What are null values?
If the value of a field in a table is undefined or unknown, it
is called a null value.
65. What is the difference between a structure and
a table?
Structures are constructed the almost the same way as
tables, the only difference using that no database table is
generated from them.
66. What is a view?
A view is a logical view on one or more tables. A view on
one or more tables i.e., the data from a view is not
actually physically stored instead being derived from one
or more tables.
67. How many types of Views are there?
Database View
Help View
Projection View
Maintenance View
68. What is Locking?
When two users simultaneously attempt to access the

same data record, this is synchronized by a lock


mechanism.
69. What is database utility?
Database utility is the interface between the ABAP/4
Dictionary and the underlying the SAP system.
70. What are the basic functions of Database
utility?
The basic functions of database utility are:
Create database objects.
Delete database objects.
Adjust database objects to changed ABAP/4 dictionary
definition.
71. What is Repository Info. Systems?
It is a tool with which you can make data stored in the
ABAP/4 Dictionary available.
72. If a standard domain has fixed values assign
how we can add custom values it.?
Most of the time answer will be we will need an access key
to modify the same. But the correct answer is we can
create append for domain values as we do for
tables/structures

Client Depend Settings:


* Client depend settings are objects that are only used in a
specific client they are
a) Client specific tables
b) Customer master records
c) User master records
d) Authorisation profiles
e) Customer specific programs are
all clients dependant data

You cannot access data in other clients .each clients data


is protected from unauthorized access. reporting cannot
be performed across all clients. data between clients
cannot be exchanged

Client independent settings:


Client independent elements are objects that are used ain
all clients
a) System programs and data dictionary repository
objects are all client independent
b)Access sequence
c)Data structures, field definition, table definitions,
table structure, file setups, client independent tables are
all client independent settings
d) transactions, standard reporting, authorization
objects,SAP library and other independent settings.

ABAP Performance and Tuning


What tools can be used to help with performance
tuning?
ST05 is the performance trace. It contains the SQL Trace
plus RFC, enqueue and buffer trace. Mainly the SQL trace
is used to measure the performance of the select
statements of the program.
SE30 is the Runtime Analysis transaction and can be used
to measure the application performance.

SAT transaction is the replacement of the pretty outdated


SE30. Provides same functionality as SE30 plus some
additional features.
ST12 transaction (part of ST-A/PI software component) is a
combination of ST05 and SAT. Very powerful performance
analysis tool used primarily by SAP Support.
One of the best tools for static performance analyzing
is Code Inspector (SCI). There are many options for finding
common mistakes and possible performance bottlenecks.
What are the steps to optimize the ABAP Code?
1.

DATABASE

a.

Use WHERE clause in your SELECT statement to


restrict the volume of data retrieved. Very important !!

b.

Design your Query to Use as much index fields


as possible in your WHERE statement

c.

Use INNER (or OUTER under some


circumstances) JOIN in your SELECT statement to retrieve
the matching records at one shot

d.

Avoid using nested SELECT statement and


SELECT within LOOPs, better use JOINs or FOR ALL
ENTRIES. Use FOR ALL ENTRIES when the internal table is
already there or the end of some processing. Try JOINs if
the SELECT are right behind each other

e.

Avoid using INTO CORRESPONDING FIELDS OF


TABLE during buffered access. Otherwise use the most
appropriate for the program.

f.

Avoid using SELECT * and Select only the


required fields from the table.

g.

Avoid using ORDER BY in SELECT statements if


it differs from used index (instead, sort the resulting
internal table), because this may add additional work to
the database system which is unique, while there may be
many ABAP servers

h.

INDEX: Creation of Index for improving


performance should not be taken without thought. Index
speeds up the performance but at the same time adds two
overheads namely; memory and insert/append
performance. When INDEX is created, memory is used up
for storing the index and index sizes can be quite big on
large transaction tables! When inserting new entry in the
table, all the index's are updated. More index more time.
More the amount of data, bigger the indices, larger the
time for updating all the indices

i.

Avoid Executing an identical Select (same


SELECT, same parameter) multiple times in the
program. Buffer in your abap code.

j.

Avoid using join statements if adequate


standard views exist no performance impact

2.

TABLE BUFFER:

a.

Defining a table as buffered (SE11) can help in


improving the performance but this has to be used with
caution. Buffering of tables leads to data being read from
the buffer rather than from table. Buffer sync with table
happens periodically, only if something changes which
is happen rarely. If this table is a transaction table
chances are that the data is changing for a particular
selection criteria, therefore application tables are
usually not suited for table bufferung. Using table
buffering in such cases is not recommended. Use Table
Buffering for configuration data and
sometimes for Master Data..

b.

Avoid using complex Selects on buffered tables-,


because SAP may not be able to interpret this request,
and may transmit the request to the database- The code
inspector tells which commands bypass the buffer

3.
a.

Internal tables
Use HASHED tables where-ever possible.
Otherwise SORTED tables. STANDARD tables should be
the last choice.

b.

Use assign instead of into in LOOPs for table


types with large work areas, if the data is being modified.

c.

When in doubt call transaction SE30 and check


your code.

d.

If you must use a STANDARD table and you are


using a READ, sort the table appropriately and use the
addition BINARY SEARCH to speed up the search.

4.
a.

Miscellaneous
PERFORM : When writing a subroutine, always
provide type for all the parameters. This reduces the
overhead which is present when system determines on it's
own each type from the formal parameters that are
passed. It also makes for more robust programming.
What is the difference between SELECT SINGLE and
SELECT ... UP TO 1 ROWS?

SELECT SINGLE and SELECT UP TO n ROWS return


the first matching row/rows for the given condition. It may
not be unique, if there are more matching rows for the
given condition.

With ORACLE database system, SELECT SINGLE is


converted into SELECT ... UP TO 1 ROWS, thus they are
exactly the same in that case. The only difference is the
ABAP syntax prevents from using ORDER BY with SELECT
SINGLE, but it is allowed with SELECT ... UP TO 1 ROWS.
Thus, if several records may be returned and we want to
get the highest record for example, SELECT SINGLE cannot
be used, but SELECT ... UP TO 1 ROWS WHERE ... ORDER
BY ... may be used.
Which is the better - JOINS or SELECT... FOR ALL
ENTRIES...?
In most scenarios INNER JOIN performs better than FOR
ALL ENTRIES, and should be used first. Only if there are
performance issues should FOR ALL ENTRIES be
considered, and careful measurements taken before and

after to validate whether there really are performance


gains.
The effect of FOR ALL ENTRIES needs to be observed first
by running a test program and analyzing SQL trace.
Certain options set by BASIS can cause FOR ALL ENTRIES
to execute as an 'OR' condition. This means if the table
being used FOR ALL ENTRIES has 3 records, SQL Trace will
show 3 SQL's getting executed. In such a case using FOR
ALL ENTRIES is useless. However of the SQL Trace shows 1
SQL statement it's beneficial since in this case FOR ALL
ENTRIES is actually getting executed as an IN List.
JOINS are recommended over FOR ALL ENTRIES. There is
no real limit to the number of tables that can be joined;
however greater complexity can make maintenance
harder, and if there are problems with the join, make it
harder to resolve them. If the JOIN is being made on fields
which are key fields in both the tables, it reduced program
overhead and increases performance.

Difference between BAPI and RFC


BAPI are RFC enabled function modules. The difference
between RFC and BAPI are business objects. You create
business objects(using transition SWO1) and those are
then registered in your BOR (Business Object Repository)
which can be accessed outside the SAP system by using
some other applications (Non-SAP) such as VB or JAVA. In
this case u only specify the business object and its method
from external system. in BAPI there is no direct system
call. While RFC are direct system call Some BAPIs provide
basic functions and can be used for most SAP business
object types. These BAPIs should be implemented the
same for all business object types. Standardized BAPIs are
easier to use and prevent users having to deal with a
number of different BAPIs. Whenever possible, a
standardized BAPI must be used in preference to an
individual BAPI.

BAPI

BAPI stands for Business API(Application Program


Interface).
A BAPI is remotely enabled function module
ie it can be invoked from remote programs like standalone
JAVA programs, web interface etc..
You can make your function module remotely enabled in
attributes of Function module but
A BAPI are standard SAP function modules provided by
SAP for remote access.
Also they are part of Businees Objest Repository(BOR).

BAPI are RFC enabled function modules. the difference


between RFc and BAPI are business objects.
You create business objects and those are then registered
in your BOR (Business Object Repository)
which can be accessed outside the SAP system by using
some other applications (Non-SAP) such as VB or JAVA.
In this case u only specify the business object and its
method from external system
in BAPI there is no direct system call. while RFC are direct
system call.

Some BAPIs provide basic functions and can be used for


most SAP business object types.

These BAPIs should be implemented the same for all


business object types.
Standardized BAPIs are easier to use and prevent users
having to deal with a number of different BAPIs.
Whenever possible, a standardized BAPI must be used in
preference to an individual BAPI.

TABLES:
Standard Table - the most commonly used type of table.
You can sort and resort this table anytime. You can have
duplicate records in them. Recommend that when
accessing these tables, you sort them by a key and then
READ via a BINARY SEARCH - better performance. When
you write to this table the record is "appended" to the end
of the table. In order to maintain the sort sequence (if any)
you must use the SORT command again.

Sorted table - this table has a defined sort sequence. You


cannot resort. You can have duplicates. When you READ
these tables, SAP automatically tries to use a BINARY
SEARCH. Because you use a Binary Search, the retrieval
time is exponential to the number of records. When you
write a record to this table the table is resorted.

Hashed Table - this table has a defined key. When you


write to the table it uses a hashing algorithm to identify
where the record is stored (think if this as writing the
location of a page in an index of a book). When you READ
this table the system looks up this "index" and retrieves
the record. Because of this the retrieval time is constant.
Writing to this type of table takes the most time as it
needs to calculate the hashing algorithm.

Personally I generally use Standard Tables as they are the


most flexible table available. It lets me resort my data
anyhow I like any time I like. I very rarely use a Sorted
Table.

I use Hashed Tables as "buffer" tables. Let's say for


example I want to retrieve HR data for a number of sales
reps. To get HR data I need to use FM
'HR_READ_INFOTYPE'. This takes time. So what I do is read
my hashed table to see if I have already got the data (very
quick). If I don't have the data, I hit the FM and update my
hashed table for next time. By using the hashed table in
this way I reduce the number of FM calls I need to make.
How to add button to ALV Toolbar:
In order modify PF_STATUS of ALV grid report you need to
perform the following steps:
1. Update 'REUSE_ALV_GRID_DISPLAY' FM call to
include:
i_callback_pf_status_set = 'SET_PF_STATUS'
statement.
2. Create 'SET_PF_STATUS' FORM
3. Create pf_status (i.e. 'ZNEWSTATUS').
- It is recommend that you copy standard
status'STANDARD' from function group SALV
and modify it accordingly. ALV standard function
codes always start with '&'.

call function 'REUSE_ALV_GRID_DISPLAY'


exporting
i_callback_program

= gd_repid

i_callback_top_of_page = 'TOP-OF-PAGE'
i_callback_pf_status_set = 'SET_PF_STATUS' "see
FORM
is_layout

= gd_layout

it_fieldcat

= fieldcatalog[]

i_save

= 'X'

tables
t_outtab

= it_ekko

exceptions
program_error
others

=1
= 2.

SAP ABAP Interview Questions Part 3 : Smartforms

Welcome to yet another post on ABAP interview questions.


Here I have complied a list of interview questions on
Smartforms in SAP. This list is quite comprehensive. Hope
you find it useful. Cheers !!
Smartform is SAP's print form technology and is an
alternative to SAP-Scripts. Whenever you activate a
Smartform , a function module is generated for that

Smartform. The program that calls this function module is


called the Driver Program for Smartform. The T.code for
Smartforms is SMARTFORMS.
Unlike SAP-Scripts, Smartforms are client
independent.
Here we go:
Why we need to use SSF_function_... fm? Why we
dont pass FM name directly to this fm?

Ans: If you directly use the name of the function module


in your program, your program will work in your server ,
but it wont work in different server.
Because , this name is generated by SAP and its not same
for different server. But the form name is same across all
servers. That s why we use SSF function module to get the
name of SAP generated FM name.

Folder Node:
1. It just use to combine diferrent node into logical
groups.
2. It can be used for page protection by checking the
page protect check box. So that everything in folder will
be printed on same page.
To display Icon in smartform ... create text - > editor > menu bar - > Insert - > characters - > SAP Icons or SAP
Symbols
Main Features of Smart Forms
1. Smart forms are created in a utility, 'Form Builder'
which is very user-friendly compared to the
environment for SAPscript creation.
2. The form logic is represented by a hierarchy structure
(tree structure) that consists of individual nodes,
such as nodes for global settings, nodes for texts,
nodes for output tables, or nodes for graphics. To
make changes, use Drag&Drop, Copy&Paste, and

select different attributes. These actions do not


include writing of coding lines or using a Script
language.
3. The System automatically creates the start page and
a window (of type MAIN) under it.
4. These are used to control the flow logic. Various
Auxiliary nodes are,

Template- Output of a table containing


static data


Table - Output of a table containing
application data

Loop - Processes successor node repeatedly.


Alternative- Branches depending on
condition.

Command - Executes special commands
(next page, paragraph numbering, printer
control)

Folder- Combines successor nodes to logical
groups

Complex Section- Combines all attributes of
the node types template, table, loop, folder

Program Lines - Executes ABAP program
code (for example, conversion routines
Template: This node is to be used for displaying
a table whose layout and number of rows and
columns is determined before run-time.

5. Basic Nodes
6. Graphic, Address and Text fall under this category. A
'text' node can be created only as a successor of a

Window node (i.e., it cannot be created directly under


a page), as it needs some output area in which it has
to appear. On the other hand, Graphic and Address
can either be created as successor nodes of a
'window' node or they can be directly created under a
'page' node.
7.
*An SAP R/3 system has 2 clients 800 & 810. You
create an SAP Script Z_Script and a Smartform
Z_Smartform in client 800. Will both Z_Script and
Z_Smartform be available in client 810 as well?
Client 200 will have just the Smartform Z_Smartform and
not the SAP Script Z_Script.
SAP-Script is client dependent whereas SMARTFORM is
client independent. Many people don't understand what
this is all about. The above answer should suffice.
However, if you still do not understand this, find an SAP
system where you have 2 clients. Create a dummy
Smartform / script in one client and check whether they
exist in the other client.
*You have created a Smartform in DEV
environment. Then you migrated the Smartform to
PROD environment. Will the name of the function
module be same in DEV and PROD?
Once you transport the Smartform from DEV to PROD
environment, a new function module name for the
Smartform in generated in the PROD environment. For a
particular Smartform , generated function module names
are different in different systems.One can get the name of
the function module for Smartform by passing the
Smartform name to FM SSF_FUNCTION_MODULE_NAME.
Hence in the driver program for Smartform, it is common
practice to use FM SSF_FUNCTION_MODULE_NAME and
then calling the Smartform Function Module.
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING

formname = 'Z_SMARTFORM'
IMPORTING
fm_name = lv_fm_name
CALL FUNCTION lv_fm_name
*How do you convert a Smartform Output to PDF
output?
There is a tricky solution here.But let's keep that for the
last. Let us first discuss the conventional way of getting a
PDF output for Smartform. For that you need to keep in
mind 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.
Here is one more and probably the easiest way to see PDF
output for a Smartform.
Type PDF! in the command prompt and hit enter :).

To see the Smartform Print Preview output as list output,


Type SLIS in the command prompt and hit enter.

*How do you achieve Bar Code printing in


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

It can be finally used to print Barcode as:


How do you add a Watermark Or a Background
Image for Smartforms ?
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.
How will you print on both sided of a Smartform?
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.

What is the difference in a Table and a Template in


Smartform?
A Template has fixed number of Rows and Columns
whereas a Table can have variable rows i.e. you can have
a internal table with contents associated to a Table
element but not to a Template.
You should use a template when the tabular output is
fixed!
How do you achieve Page Protection in Smartform ?
While one can use the PROTECT ..... ENDPROTECT
command for SAP-Scripts, for Smartforms the PageProtection checkbox can be used to ensure page
protection:
Note: You have Page-protection property only for Text
Elements in the Main Window.
Can you move a Smartform from one SAP system to
another without using transports ?
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.
Can you have a Smartform without a main window?
Yes, you can create a Smartform without a Main Window.
But there is no need to do anything of such sort.
Whenever you create a Smartform, a main window is
created by default. I can't think of a situation , where you
will have a situation in which it is mandatory for you to
remove the Main Window. But still I have seen this
question in ABAP interviews. So I have put it here.
How do you find the name of the Function Module
for a Smartform?
When is this function module created?
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.

What is a Copies Window?


What is a Final Window?
Final Window is called after all the other windows are
called in a Smartform.
ALE IDocs in SAP
ALE IDocs in SAP is a lot about configuration and a lot
about Tcodes . So if you have worked on at least one end
to end scenario in ALE IDocs in SAP , you probably
already have answers to a lot of questions.
Cheers!!
But if you haven't , make sure you do this exercise. There
are plenty of step by step guides to ALE IDocs available on

the internet . Make sure you read one understand it all the
way . Sending IDoc from client 800 to say client 810 on
the same server is easy . If possible ,Try an exercise in
which you send an IDoc from one system to another
system.
Lets get started . Hope you get some value in these pages
:)
Question 1: What is ALE ?
ALE stands for Application Link Enabling. As it's name
indicates , it links two systems.
ALE is a technology that can enable exchange of data
between two different Systems ( Sap - Sap OR Sap - Non
Sap). ALE technology enables distributed yet integrated
installation of SAP systems.
ALE architecture comprises of 3 layers :
Application layer refers to the application data ( SD , MM
, FI or data for any SAP application ) . In this layer the data
is collected to be distributed and then sent to the
distribution layer.
Distribution layer determines to whom should the data
generated by the application layer has to be distributed
i.e. it is in the distribution layer that the recipient is
determined , the data is formatted or filtered and then an
actual is created.
Communication layer takes the responsibility of
delivering the Idoc to the receiving system and
communicates to the receiving system via tRFC , File ports
, FTP or TCP/IP etc.
ALE uses IDoc as a vehicle to transfer data between
two systems.
Question 2: What is EDI ?
EDI stands for Electronic Data Interchange. It refers to the
electronic exchange of business data in a structured

format between two systems. The EDI subsystem


generally converts the Idoc data into one of the many EDI
formats and generates an EDI file in an X12 format. The
middleware then translates the X12 file to an IDOC format
and the IDOC is sent to the SAP system.
Question 3: What is an Idoc? What is IDoc Type? What
is an IDoc Extension ?
An IDoc (Intermediate document) is a vehicle that is used
to transfer data from one system to another.
IDoc is not a technology of some sort , but it is just
a container that holds data .
It holds data in a structured format i.e. in the Fields of the
Segments.
IDoc Type vs. IDoc:
An IDoc Type is nothing but a collection of one or more
structures defined in a system with specific fields. It does
not hold Data.
However, an IDoc is something that holds the values in the
fields of the structure defined by IDOC type.
The transaction code to view an IDoc type (Basic and
extension) is WE30.
Examples: ORDERS04, DEBMAS04, MATMAS04,
CREMAS04.
These are all SAP standard Basic IDoc Types.
You can even have an IDoc extension in which you can
use the existing Basic IDoc type and add extra segments
and fields to it. Usually we extend an IDoc when the
standard SAP IDoc type is not able to cater to the business
process.
Question 4: What are the types of records in SAP ALE
Idocs and where is this information stored ?
There are three types of records in SAP ALE Idocs:
Control Records: Control record information for an IDoc
is stored in standard table EDIDC.
Data Records:
Data record information for an IDoc is
stored in standard table EDIDD.

Status Records: Status record information for an IDoc is


stored in standard table EDIDS.
Question 5: What is an Idoc status? What are the
different types of Idoc statuses that you know ?
When an IDoc is sent from one system to another , it goes
through variuos stages.The IDoc status indicates the stage
that the Idoc is currently in.
There about 75 IDoc statuses.There is no way you can
remember those all .
Don't even try to ! You will probably remember only those
on which you have worked .
But here are a few that you should know:
0-49 indicates an Outbound IDoc and 50-75 as Inbound
IDoc.
01 IDoc generated
02 Error passing data to port
03 Data passed to port OK
51 Application document not posted
52 Application document not fully posted
53 Application document posted
Question 6: What is a Port ? What are the types of
Ports ?
A port is a communication channel through which
Messages can be sent or received in SAP .
The sender and the receiver both specify the port through
which they will communicate.
The common port types are the TRFC Port and the File
Port.
If both sender and receiver mention TRFC ports, data is
exchanged via RFC connections.
If however , a file port is mentioned , the IDOC is written in
a flat file at the specified location at the sender
system.Then a FTP transfer should be done from that
location to the receiver system or a Middleware that will

send the file to the receiver system.


The transaction to maintain ports is WE21.
Question 7: What is a Message type and Idoc Type ?
What is the difference between Message type and an IDoc
type?
A Message type and an IDoc type are closely related . In
fact, you will find that a Message type is always associated
with an IDoc type.Whereas an IDoc type is a detailed
version with all the segments and fields , a Message
type is used just to specify the kind of information
that a system can send or receive to or from
another system.
So If system SAP1 has a Partner Profile where it
specifies MATMAS as an outbound message type , it just
means that SAP1 can send material master data to say
system SAP2.
If system SAP1 has a Partner Profile where it
specifies MATMAS as an inbound message type , it just
means that SAP1 can receive material master data from
say system SAP2.
What all fields can be sent and received will be specified in
the IDoc type.
Some other message
types: DEBMAS( Customers), CREMAS(Vendors) belong
to the Master data.
The link between a message Type and an IDoc type is
maintained in Tcode WE82.
Question 8: What is a partner profile ? What are the
types of partner profiles ?
To be able to communicate with a partner via an IDoc
interface, each system needs to maintain a partner profile.
A partner profile is a mechanism by which the system can
specify what kind of messages (message types) it can

send or receive.
Partner profiles can be maintained in WE20.
Question 9: What is a distribution model in ALE IDocs ?
The distribution model describes how ALE messages flow
between different logical systems.
You can mention the sender and receiver logical systems,
the message type to be distributed and also distribute
data(IDocs) based on certain conditions by using the
distribution model.
The ALE layer uses the distribution model to control which
systems will receive the information(IDocs) and also filter
the data based on certain conditions.
Distribution Models can be created and maintained in
transaction BD64.
Question 10: What are process codes ?
In ALE ie, the data requested system is receiver and the
data already presented system is sender ie, from where
we are having the data,

here in sender side----

we need a program to tranfer required data into idoc-( idoc is just a data container ) in sender side this
program logic is in a function module it is configured in
we41.

ie this will transfer the data from database to idoc---in sender side it is a process code

and in receiver side after receiving the data we have to


post it in database again program needed it is also ie the
required code is also in function module it is configured in
we42

Question 11: How do you Edit IDoc contents manually?


Question 12: Can you edit IDoc content for successful
IDocs ?
No. You cannot.
Question 13: If you send an IDoc say 100008008 from
system ECC1 to system ECC2, will the IDoc number in
ECC2 be 100008008?
No. The next number from the IDoc number range in ECC2
will be picked up.

SAP ABAP Interview Questions Part 1


Important
Question 1: What is the difference between User
Exit and Function Exit?
User Exit
Customer Exit
These are implemented in the A customer exit can be
form of subroutines and
implemented as:
hence are also known as

Function exit
FORM EXITs. The user exits
Screen Exit
are generally collected in

Menu Exit
includes and attached to the
Field Exit
standard program by the SAP. Example: CALL Customer
User-exits are empty
function xxx
subroutines that SAP
INCLUDE xxx.
Developers have provided for You modify this include.
you. You can fill them with

your own source code.


All User exits start with the
word USEREXIT_...
FORM USEREXIT_XXXX....
INCLUDE ZZUSEREXIT.......
ENDFORM.
In case of a PERFORM, you
have access to almost all the
data. So you have better
control, but more risk of
making the system unstable.
User exit is considered a
modification and not an
enhancement.
You need Access Key for User
Exit.
Changes are lost in case of an
upgrade.
User exit is the earliest form
of change option offered by
SAP.
No such thing is required
here.

You have access only to


the importing, exporting,
changing and tables
parameter of the Function
Module. So you have
limited access to data.
A customer exit is
considered an
enhancement.
You do not need access
key.
Changes are upgrade
compatible.
Customer exits came later
and they overcome the
shortcomings of User Exit.
To activate a function exit,
you need to create a
project in SMOD and
activate the project.

link : http://wiki.scn.sap.com/wiki/pages/viewpage.action?
pageId=189893877
User exits can be found in the following ways:
Go to Object Navigator (SE80), select Package and put
VMOD. You will find all the includes for user exits in SD.
What is the difference between RFC and BAPI?
BAPI
RFC
Just as Google offers
RFC is nothing but a remote
Image/Chart/Map APIs OR
enabled function module. So if
Facebook offers APIs for
there is a Function Module in
Comment/Like, SAP offers APIs in SAP system 1 on server X , it
the form of BAPIs. BAPI is a
can be called from a SAP

library of function modules


released by SAP to the public so
that they can interface with SAP.
There is a Business Object
Associated with a BAPI. So a
BAPI has an Interface, Key Field,
Attributes, Methods, and Events.
Outside world (JAVA, VB, .Net or
any Non SAP system) can
connect to SAP using a BAPI.
Error or Success messages are
returned in a RETURN table.

system 2 residing on server Y.

No Business Object is
associated with a RFC.

NonSAP world cannot connect


to SAP using RFC.
RFC does not have a return
table.

Question 3:What is the difference between


SAPSCRIPT and SMARTFORM?
SAPSCRIPT
SMARTFORM
SAPSCRIPT is client dependent. SMARTFORM is client
independent.
SAPSCRIPT does not generate
SMARTFORM generates a
any Function module.
Function Module when
activated.
Main Window is must.
You can create a SMARTFORM
without a Main Window.
SAPSCRIPT can be converted to SMARTFORMS cannot be
SMARTFORMS. Use Program
converted to SCRIPT.
SF_MIGRATE.
Only one Page format is
Multiple page formats are
possible
possible.
Such thing is not possible in
You can create multiple copies
SCRIPT.
of a SMARTFORM using the
Copies Window.
PROTECT ENDPROTECT
The Protect Checkbox can be
command is used for Page
ticked for Page Protection.
protection.
The way SMARTFORM is developed and the way in which
SCRIPT is developed is entirely different. Not listing down
those here. That would be too much.

Question 4:What is the difference between Call


Transaction Method and the Session method ?
Session Method
Session method id generally
used when the data volume is
huge.
Session method is slow as
compared to Call transaction.

Call Transaction
Call transaction method is
when the data volume is low

Call Transaction method is


relatively faster than Session
method.
SAP Database is updated when SAP Database is updated
you process the sessions. You
during the execution of the
need to process the sessions
batch input program.
separately via SM35.
Errors are automatically
Errors should be handled in the
handled during the processing batch input program.
of the batch input session.
Question 5: What is the difference between BDC
and BAPI?
BAPI
BAPI is faster than BDC.

BDC
BDC is relatively slower than
BAPI.
BAPI directly updates
BDC goes through all the
database.
screens as a normal user
would do and hence it is
slower.
No such processing options are Background and Foreground
available in BAPI.
processing options are
available for BDC.
BAPI would generally used for
BDCs would be preferred for
small data uploads.
large volumes of data upload
since background processing
option is available.
For processing errors, the
Errors can be processed in
Return Parameters for BAPI
SM35 for session method and
should be used. This
in the batch input program for
parameter returns exception
Call Transaction method.
messages or success
messages to the calling

program.
Question 6: What is the difference between macro
and subroutine?
Macro
Macro can be called only in
the program it is defined.
Macro can have maximum 9
parameters.
Macro can be called only after
its definition.

Subroutine
Subroutine can be called
from other programs also.
Can have any number of
parameters.
This is not true for
Subroutine.

A macro is defined inside:


DEFINE
.
END-OF-DEFINITION.
Macro is used when same
thing is to be done in a
program a number of times.

Subroutine is defined inside:


FORM ..
..
ENDFORM.
Subroutine is used for
modularization.

Question 7: What is the difference between SAP


memory and ABAP memory?
SAP Memory
When you are using the
SET/GET Parameter ID
command, you are using the
SAP Memory.
SAP Memory is User Specific.
What does this mean?The
data stored in SAP memory can
be accesses via any session
from a terminal.

ABAP Memory
When you are using the EXPORT
IMPORT Statements, you are
using the ABAP Memory.
ABAP Memory is User and
Transaction Specific.What does
this mean? The data stored in
ABAP memory can be accessed
only in one session. If you are
creating another session, you
cannot use ABAP memory.

Important
Question 8: What is the 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.
Question 9: What is the difference between SYINDEX and SY-TABIX?
Remember it this way TABIX = Table.
So when you are looping over an internal table, you use
SY-TABIX.
When you use DO ENDDO / WHILE for looping, there is
no table involved.
So you use SY-INDEX.
For READ statement, SY-INDEX is used.
Question 10: What is the difference between VIEW
and a TABLE?A table physically stores data.
A view does not store any data on its own. It can contain
data from multiple tables and it just accesses/reads data
from those tables.
Question 11: What is the difference between
Customizing and Workbench request?A workbench
request is client independent whereas a Customizing
request is client dependent.
Changes to development objects such as Reports, Function
Modules, Data Dictionary objects etc. fall under
Workbench requests.
Changes in SPRO / IMG that define system behavior fall
under customizing requests.
An example would be defining number ranges in SPRO.
In short, generally a developer would end up creating a
Workbench request and a Functional Consultant would
create a Customizing request.

Question 12: What is the difference between PASS


BY VALUE and PASS BY REFERENCE?These concepts
are generally used for Function modules or Subroutines
etc. and their meaning can be taken literally.
Say we are passing a variable lv_var:
CALL FUNCTION 'DEMO_FM'
EXPORTING
VAR = lv_var.
When we PASS lv_var by VALUE , the actual value of lv_var
is copied into VAR.
When we PASS lv_var by REFERENCE , the reference or the
memory address of lv_var is passed to the Function
module. So VAR and lv_var will refer to the same memory
address and have the same value.
Question 13: What is the difference between Master
data and Transaction data?Master data is data that
doesnt change often and is always needed in the same
way by business.
Ex: One time activities like creating Company Codes,
Materials, Vendors, Customers etc.
Transaction data keeps on changing and deals with day to
day activities carried out in business.
Transactions done by or with Customers, Vendors, and
Materials etc. generate Transaction Data. So data related
to Sales, Purchases, Deliveries, Invoices etc. represent
transaction data
Some important transactions here for Master Data:
Material: MM01 MM02 MM03
Vendor: XK01 , XK02 , XK03
Customer: Xd01 , XD02 , XD03
Some Important transactions for Transaction data:
Purchase Order: ME21n , ME22n , ME23n
Sales Order: VA01 , VA02 , VA03

Goods Receipt: MIGO


Invoices: MIRO
Important
Question 14: What will you use SELECT SINGLE or
SELECT UPTO 1 ROWS ?
What will you use SELECT SINGLE or SELECT UPTO 1
ROWS ?
There is great confusion over this in the SAP arena.
If you Google, you will see lots of results that will say
SELECT SINGLE is faster and efficient than SELECT UPTO 1
ROWS.
But that is 100% incorrect.
SELECT UPTO 1 ROWS is faster than SELECT SINGLE.
If for a WHERE condition, only one record is present in DB,
then both are more or less same.
However, If for a WHERE condition multiple records are
present in DB, SELECT UPTO 1 ROWS will perform better
than SELECT SINGLE.
Question 15: What is the difference between .Include
Structure and .Append structure?
I have seen ridiculous answers for this at many places on
the Web.
The true answer is this:
Lets say you want to use the Structure X in your table Y.
With .Include X, you can include this structure in multiple
tables.
With .Append X, you specify that structure X has been
used in table Y and that this cannot be used in any other
table now. So you restrict structure X only to Table Y.
Important
Question 16: Can you describe the events in ABAP?
LOAD-OF-PROGRAM:
INITIALIZATION: If you want to initialize some values
before selection screen is called
AT SELECTION SCREEN OUTPUT: PBO for Selection

Screen
AT SELECTION SCREEN: PAI for Selection Screen
START-OF-SELECTION
END-OF-SELECTION
TOP-OF-PAGE
END-OF-PAGE
AT USER-COMMAND: When user click on say buttons in
application toolbar. SY-UCOMM
AT LINE SELECTION: Double click by user on basic
list. SY-LISEL
AT PF##: When User Presses any of the Function Keys
TOP-OF-PAGE DURING LINE SELECTION
Question 17:
What events do you know in Module Pool
Programming?
PBO: you know this . If not you should know this . That's
basic.
PAI: You know this. If not you should know this . That's
basic.
POV: Process on Value request i.e. when you press F4.(
F4IF_INT_TABLE_VALUE_REQUEST)
POH: Process on help request i.e. when you press F1.
Question 18: Can you show multiple ALVs on a
Single Screen?
Yes, there are multiple ways of doing this:

If you are using OOALV, you can create multiple


custom containers
(cl_gui_custom_container) & put an ALV
control (cl_gui_alv_grid) in each of those.

1.
2.
3.

You can even use a Splitter container control and place


multiple ALVs in each of the split container.
If you are using Normal ALV, You can use the following
FMS:
REUSE_ALV_BLOCK_LIST_INIT
REUSE_ALV_BLOCK_LIST_APPEND
REUSE_ALV_BLOCK_LIST_DISPLAY

Question 19: A system has two clients 100 and 500 on


the same application server. If you make changes to a
SAPSCRIPT on client 100, will the changes be available in
client 500?
No. SAPSCRIPT is client dependent. You will have to
transport changes from client 100 to client 500. However,
for SMARTFORMS, Changes will be made both for client
100 and client 500.
Question 20: There are 1000s of IDOCs in your system
and say you no longer need some of them? How will you
get rid of those IDOCs?
One way is to archive the IDOCs using transaction SARA.
But what the interviewer was expecting was How do you
change IDoc Status?
There are different ways of doing this:
A) Use FM IDOC_STATUS_WRITE_TO_DATABASE
B) USE FMs:
EDI_DOCUMENT_OPEN_FOR_PROCESS and
EDI_DOCUMENT_CLOSE_PROCESS
Question 21: What is the difference between CHAIN
ENDCHAIN and FIELD commands in Module Pool?
If you want to validate a single field in Module Pool, you
use the FIELD Command.
On error, this single filed is kept open for input.
If you however want to validate multiple fields, you can
use the CHAIN ENDCHAIN command. You specify
multiple fields between CHAIN and ENDCHAIN.
On error, all fields between CHAIN ENDCHAIN are kept
open for input.
e.g.
CHAIN.
FIELD gs_final-zaccntmnt.
FIELD gs_final-zzpspid.

MODULE tc_9000_modify ON CHAIN-REQUEST.


ENDCHAIN.
FIELD gs_final-sel
MODULE tc_9000_mark ON REQUEST.
Question 22: What are the types of Function
Modules? What is an UPDATE function module?
There are three types of Function Modules: Normal ,
RFC , UPDATE

The aim of the Update function module is either to


COMMIT all changes to database at once or to ROLLBACK
all the changes. By definition, an update function module
is used to bundle all the updates in your system in one
LUW (logical unit of work).
This FM is called whenever COMMIT WORK statement is
encountered in the calling program and the way you call it
is CALL FUNCTION XXX IN UPDATE TASK.
Have a look at FM EDI_DOCUMENT_CLOSE_PROCESS_UPD
and do a where used.
This FM is used as Update FM in case you make changes
to IDoc contents/status via your program.
Question 23: How is the table sorted when you do not
specify field name and Ascending or Descending? On what
criteria will the table be sorted? Do internal table have
keys?
Yes, internal table have keys.
The default key is made up of the non-numeric fields of
the table line in the order in which they occur.
The sort order default is ascending.
Question 24: Explain what is a foreign key
relationship?Explain this with the help of an example.

Lets discuss about tables EKKO (PO header) and EKPO (PO
line item).
Can you have an entry in table EKPO without having an
entry in table EKKO?
In other words can you have PO line items without the PO
header?
How does this happen? The answer is foreign key
relationship.
So foreign keys come into picture when you define
relationship between two tables.

Foreign keys are defined at field level.


Check the foreign key relation for field EBELN of table
EKPO.
The check table is EKKO. This just means that whenever
an entry is made in EKPO, it is checked whether the
entered value for EBELN already exists in EKKO. If not,
entry cannot be made to EKPO table.
Question 25 : What is the difference between a
value table and a check table?
Check table is maintained when you define foreign key
relationships.
For Check table, read question above.
.
Value table is defined and maintained at a domain level.
At a domain level, you can mention allowed values in the
form of:
1) Single values
2) Ranges
3) Value table For example, have a look at domain SHKZG.
Only allowed values are S and H for Debit/Credit indicator.
Whenever and wherever you use this domain, the system
will force you to use only these two values: S and H.
Another example is domain MATNR. For this domain the
value table is MARA.
So whenever and wherever, you use this domain the

system will force you to use values for MATNR in table


MARA.

Question 26: How do you find BAPI?Approach1:


You can go to Transaction BAPI and then search for your
desired object.
Say you want to find a BAPI for creating users in the
system, in such case you can search for the User and find
the relevant BAPIs.
Approach2:
Another way is to find a Business Object. Say you want to
find a BAPI for creating Material in SAP and you know the
BO for Material is BUS1001006. You can go to Transaction
SWO1 and enter the BO BUS1001006 in the BOR. Then
have a look at the methods for this BO.

Important
Question 27: How do you find BADI?
Approach1:
Go to Class CL_EXITHANDLER in SE24 ---> Put a
breakpoint in method GET_INSTANCE.Now go and
execute your transaction code for which you want to find
BADI.
You will find the BADI in the changing parameter
exit_name:

Approach 2:
Go to Tcode SE84 Enhancements BADIs Definitions.
Find the package for the Tcode for which you are finding
the BADI.
Enter it as shown and hit execute:
SLIS :

SLIS is the predifined type-group which contains


predefined data types for Building ALV report. So when
you doing ALV , you need write this statement.
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.

What is interactive reporting?


It helps you to create easy-to-read lists. You can display an
overview list first that contains general information and
provide the user with the possibility of choosing detailed
information that you display on further lists.
What are the uses of interactive reporting?
The user can actively control data retrieval and display
during the session. Instead of an extensive and detailed
list, you create a basic list with condensed information
from which the user can switch to detailed displays by
positioning the cursor and entering commands. The
detailed information appears in secondary lists.
What are the event key words in interactive reporting?
Event

Description

AT LINESELECTION

Moment at which the user selects a


line by double clicking on it or by
positioning the cursor on it and
pressing F2

AT USERCOMMAND

Moment at which the user presses a


function key

Event

Description

TOP-OF-PAGE
DURING LINESELECTION

Moment during list processing of a


secondary list at which a new page
starts

What is a secondary list?


It allows you to enhance the information presented in the
basic list. The user can, for example, select a line of the
basic list for which he wants to see more detailed
information. You display these details on a secondary list.
Secondary lists may either overlay the basic list
completely or you can display them in an extra window on
the screen. The secondary lists can themselves be
interactive again.
What is interactive reporting?
A classical non-interactive report consists of one program
that creates a single list. Instead of one extensive and
detailed list, with interactive reporting you create basic list
from which the user can call detailed information by
positioning the cursor and entering commands. Interactive
reporting thus reduces information retrieval to the data
actually required.
Can we call reports and transactions from interactive
reporting lists?
Yes. It also allows you to call transactions or other reports
from lists. These programs then use values displayed in
the list as input values. The user can, for example, call a
transaction from within a list of change the database table
whose data is displayed in the list.
What are system fields for secondary lists?

SYLSIND

Index of the list created during the current


event (basic list = 0)

SYLIST1

Index of the list level from which the event was


triggered

SY-LILLI

Absolute number of the line from which the


event was triggered

SYLISEL

Contents of the line from which the event was


triggered

SYCURO
W

Position of the line in the window from which


the event was triggered (counting starts with
1)

SYCUCOL

Position of the column in the window from


which the event was triggered (counting starts
with 2)

SYCPAGE

Page number of the first displayed page of the


list from which the event was triggered

SYSTARO

Number of the first line of the first page


displayed of the list from which the event was
triggered (counting starts with 1). Possibly, a
page header occupies this line

SY-

Number of the first column displayed in the list

STACO

from which the event was triggered (counting


starts with 1)

SYUCOM
M

Function code that triggered the event

SYPFKEY

Status of the displayed list

How to maintain lists?


To return from a high list level to the next-lower level (SYLSIND), the user chooses Back on a secondary list. The
system then releases the currently displayed list and
activates the list created one step earlier. The system
deletes the contents of the released list. To explicitly
specify the list level, into which you want to place output,
set the SY-lsind field. The system accepts only index
values, which correspond to existing list levels. It then
deletes all existing list levels whose index is greater or
equal to the index specify. For example, if you set SYLSIND to 0, the system deletes all secondary lists and
overwrites the basic list with the current secondary list.
What are the page headers for secondary lists?
On secondary lists, the system does not display a standard
page header and it does not trigger the event TOP-OFPAGE. To create page headers for secondary list, you must
enhance TOP-OF-PAGE: Syntax TOP-OF-PAGE DURING
LINE-SELECTION. The system triggers this event for each
secondary list. If you want to create different page
headers for different list levels, you must program the
processing block of this event accordingly, for example by
using system fields such as SY-LSIND or SY-PFKEY in
control statements (IF, CASE).

How to use messages in lists?


ABAP/4 allows you to react to incorrect or doubtful user
input by displaying messages that influence the program
flow depending on how serious the error was. Handling
messages is mainly a topic of dialog programming. You
store and maintain messages in table T100. Messages are
sorted by language, by a two-character ID, and by a threedigit number. You can assign different message types to
each message you output. The influence of a message on
the program flow depends on the message type. In our
program, use the MESSAGE statement to output messages
statically or dynamically and to determine the message
type.
Syntax: REPORT MESSAGE-ID <msgid>.
What are the user interfaces of interactive lists?
If you want the user to communicate with the system
during list display, the list must be interactive. You can
define specific interactive possibilities in the status of the
list's user interface (GUI). To define the statuses of
interfaces in the R/3 system, use the Menu Painter tool. In
the Menu Painter, assign function codes to certain
interactive functions. After an user action occurs on the
completed interface, the ABAP/4 processor checks the
function code and, if valid, triggers the corresponding
event.
What are the drill-down features provided by ABAP/4 in
interactive lists?
ABAP/4 provides some interactive events on lists such as
AT LINE-SELECTION (double click) or AT USER-COMMAND
(pressing a button). You can use these events to move
through layers of information about individual items in a
list.
What is meant by stacked list?
A stacked list is nothing but secondary list and is displayed
on a full-size screen unless you have specified its
coordinates using the window command.

Is the basic list deleted when the new list is created?


No. It is not deleted and you can return back to it using
one of the standard navigation functions like clicking on
the back button or the cancel button.
What is meant by hotspots?
A Hotspot is a list area where the mouse pointer appears
as an upright hand symbol. When a user points to that
area (and the hand cursor is active), a single click does
the same thing as a double-click. Hotspots are supported
from R/3 release 3.0c.
What is the length of function code at user-command?
Each menu function, push button, or function key has an
associated function code of length FOUR (for example,
FREE), which is available in the system field SYUCOMM
after the user action.
Can we create a gui status in a program from the object
browser?
Yes. You can create a GUI STATUS in a program using SET
PF-STATUS.
In which system field does the name of current gui status
is there?
The name of the current GUI STATUS is available in the
system field SY-PFKEY.
Can we display a list in a pop-up screen other than full-size
stacked list?
Yes, we can display a list in a pop-up screen using the
command WINDOW with the additions starting at X1 Y1
and ending at X2 Y2 to set the upper-left and the lowerright corners where x1 y1 and x2 y2 are the coordinates.
What is meant by hide area?

The hide command temporarily stores the contents of the


field at the current line in a system-controlled memory
called the HIDE AREA. At an interactive event, the
contents of the field are restored from the HIDE AREA.
When the get cursor command used in interactive lists?
If the hidden information is not sufficient to uniquely
identify the selected line, the command GET CURSOR is
used. The GET CURSOR command returns the name of the
field at the cursor position in a field specified after the
addition field, and the value of the selected field in a field
specified after value.
How can you display frames (horizontal and vertical lines)
in lists?
You can display tabular lists with horizontal and vertical
lines (FRAMES) using the ULINE command and the system
field SY-VLINE. The corners arising at the intersection of
horizontal and vertical lines are automatically drawn by
the system.
What are the events used for page headers and footers?
The events TOP-OF-PAGE and END-OF-PAGE are used for
pager headers and footers.
How can you access the function code from menu painter?
From within the program, you can use the SY-UCOMM
system field to access the function code. You can define
individual interfaces for your report and assign them in the
report to any list level. If you do not specify self-defined
interfaces in the report but use at least one of the three
interactive event keywords. AT LINE-SELECTION, AT PF, OR
AT USER-COMMAND in the program, the system
automatically uses appropriate predefined standard
interfaces. These standard interfaces provide the same
functions as the standard list described under the
standard list.
How the at-user command serves mainly in lists?

The AT USER-COMMAND event serves mainly to handle


own function codes. In this case, you should create an
individual interface with the Menu Painter and define such
function codes.
How to pass data from list to report?
ABAP/4 provides three ways of passing data:
---Passing data automatically using system fields
---Using statements in the program to fetch data
---Passing list attributes
How can you manipulate the presentation and attributes
of interactive lists?
---Scrolling through Interactive Lists.
---Setting the Cursor from within the Program.
---Modifying List Lines.
How to call other programs?
Report Transaction
Call and return: SUBMIT <progname> AND RETURN, CALL
TRANSACTION
Call without return: SUBMIT, LEAVE TO TRANSACTION
You can use these statements in any ABAP/4 program.
What will exactly the hide statement do?
For displaying the details on secondary lists requires that
you have previously stored the contents of the selected
line from within the program. To do this, ABAP/4 provides
the HIDE statement. This statement stores the current
field contents for the current list line. When calling a
secondary list from a list line for which the HIDE fields are
stored, the system fills the stored values back into the
variables in the program. In the program code, insert the
HIDE statement directly after the WRITE statement for the
current line. Interactive lists provide the user with the socalled 'INTERACTIVE REPORTING' facility. For background
processing the only possible method of picking the
relevant data is through 'NON INTERACTIVE REPORT' .
After starting a background job, there is no way of

influencing the program. But whereas for dialog sessions


there are no such restrictions.
How many lists can a program can produce?
Each program can produce up to 21 lists: one basic list
and 20 secondary lists. If the user creates a list on the
next level (that is, SY-LSIND increases), the system stores
the previous list and displays the new one. Only one list is
active, and that is always the most recently created list.

ABAP interview questions and answers


By admin | May 2, 2005
Thanks to the reader who sent in this question set:
1. What is an ABAP data dictionary?- ABAP 4 data
dictionary describes the logical structures of the
objects used in application development and shows
how they are mapped to the underlying relational
database in tables/views.
2. What are domains and data element?Domains:Domain is the central object for describing
the technical characteristics of an attribute of an
business objects. It describes the value range of the
field. Data Element: It is used to describe the
semantic definition of the table fields like description
the field. Data element describes how a field can be
displayed to end-user.
3. What is foreign key relationship?- A relationship
which can be defined between tables and must be
explicitly defined at field level. Foreign keys are used
to ensure the consistency of data. Data entered
should be checked against existing data to ensure
that there are now contradiction. While defining
foreign key relationship cardinality has to be
specified. Cardinality mentions how many dependent
records or how referenced records are possible.
4. Describe data classes.- Master data: It is the data
which is seldomly changed. Transaction data: It is the

5.

6.

7.

8.

data which is often changed. Organization data: It is


a customizing data which is entered in the system
when the system is configured and is then rarely
changed. System data:It is the data which R/3 system
needs for itself.
What are indexes?- Indexes are described as a
copy of a database table reduced to specific fields.
This data exists in sorted form. This sorting form ease
fast access to the field of the tables. In order that
other fields are also read, a pointer to the associated
record of the actual table are included in the index.
Yhe indexes are activated along with the table and
are created automatically with it in the database.
Difference between transparent tables and
pooled tables.- Transparent tables: Transparent
tables in the dictionary has a one-to-one relation with
the table in database. Its structure corresponds to
single database field. Table in the database has the
same name as in the dictionary. Transparent table
holds application data. Pooled tables. Pooled tables in
the dictionary has a many-to-one relation with the
table in database. Table in the database has the
different name as in the dictionary. Pooled table are
stored in table pool at the database level.
What is an ABAP/4 Query?- ABAP/4 Query is a
powerful tool to generate simple reports without any
coding. ABAP/4 Query can generate the following 3
simple reports: Basic List: It is the simple reports.
Statistics: Reports with statistical functions like
Average, Percentages. Ranked Lists: For analytical
reports. - For creating a ABAP/4 Query, programmer
has to create user group and a functional group.
Functional group can be created using with or without
logical database table. Finally, assign user group to
functional group. Finally, create a query on the
functional group generated.
What is BDC programming?- Transferring of
large/external/legacy data into SAP system using
Batch Input programming. Batch input is a automatic
procedure referred to as BDC(Batch Data
Communications).The central component of the
transfer is a queue file which receives the data vie a

batch input programs and groups associated data


into sessions.
9. What are the functional modules used in
sequence in BDC?- These are the 3 functional
modules which are used in a sequence to perform a
data transfer successfully using BDC programming:
BDC_OPEN_GROUP - Parameters like Name of the
client, sessions and user name are specified in this
functional modules. BDC_INSERT - It is used to insert
the data for one transaction into a session.
BDC_CLOSE_GROUP - This is used to close the batch
input session.
10.
What are internal tables?- Internal tables are
a standard data type object which exists only during
the runtime of the program. They are used to
perform table calculations on subsets of database
tables and for re-organising the contents of database
tables according to users need.
11.
What is ITS? What are the merits of ITS?ITS is a Internet Transaction Server. ITS forms an
interface between HTTP server and R/3 system,
which converts screen provided data by the R/3
system into HTML documents and vice-versa. Merits
of ITS: A complete web transaction can be developed
and tested in R/3 system. All transaction
components, including those used by the ITS outside
the R/3 system at runtime, can be stored in the R/3
system. The advantage of automatic language
processing in the R/3 system can be utilized to
language-dependent HTML documents at runtime.
12.
What is DynPro?- DynPro is a Dynamic
Programming which is a combination of screen and
the associated flow logic Screen is also called as
DynPro.
13.
What are screen painter and menu
painter?- Screen painter: Screen painter is a tool to
design and maintain screen and its elements. It
allows user to create GUI screens for the
transactions. Attributes, layout, filed attributes and
flow logic are the elements of Screen painter. Menu
painter: Menu painter is a tool to design the interface
components. Status, menu bars, menu lists, F-key

settings, functions and titles are the components of


Menu painters. Screen painter and menu painter both
are the graphical interface of an ABAP/4
.applications.
14.
What are the components of SAP scripts?SAP scripts is a word processing tool of SAP which
has the following components: Standard text. It is like
a standard normal documents. Layout sets. - Layout
set consists of the following components: Windows
and pages, Paragraph formats, Character formats.
Creating forms in the R/3 system. Every layout set
consists of Header, paragraph, and character string.
ABAP/4 program.
15.
What is ALV programming in ABAP? When
is this grid used in ABAP?- ALV is Application List
viewer. Sap provides a set of ALV (ABAP LIST VIEWER)
function modules which can be put into use to
embellish the output of a report. This set of ALV
functions is used to enhance the readability and
functionality of any report output. Cases arise in sap
when the output of a report contains columns
extending more than 255 characters in length. In
such cases, this set of ALV functions can help choose
selected columns and arrange the different columns
from a report output and also save different variants
for report display. This is a very efficient tool for
dynamically sorting and arranging the columns from
a report output. The report output can contain up to
90 columns in the display with the wide array of
display options.
16.
What are the events in ABAP/4 language?Initialization, At selection-screen, Start-of-selection,
end-of-selection, top-of-page, end-of-page, At lineselection, At user-command, At PF, Get, At New, At
LAST, AT END, AT FIRST.
17.
What is CTS and what do you know about
it?- The Change and Transport System (CTS) is a tool
that helps you to organize development projects in
the ABAP Workbench and in Customizing, and then
transport the changes between the SAP Systems and
clients in your system landscape. This documentation
provides you with an overview of how to manage

changes with the CTS and essential information on


setting up your system and client landscape and
deciding on a transport strategy. Read and follow this
documentation when planning your development
project.
18.
What are logical databases? What are the
advantages/ dis-advantages of logical
databases?- To read data from a database tables we
use logical database. A logical database provides
read-only access to a group of related tables to an
ABAP/4 program. Advantages: i)check functions
which check that user input is complete, correct,and
plausible. ii)Meaningful data selection. iii)central
authorization checks for database accesses. iv)good
read access performance while retaining the
hierarchical data view determined by the application
logic. dis advantages: i)If you donot specify a logical
database in the program attributes,the GET events
never occur. ii)There is no ENDGET command,so the
code block associated with an event ends with the
next event statement (such as another GET or an
END-OF-SELECTION).
19.
What is a batch input session?- BATCH
INPUT SESSION is an intermediate step between
internal table and database table. Data along with
the action is stored in session ie data for screen
fields, to which screen it is passed, program name
behind it, and how next screen is processed.
20.
How to upload data using CATT ?- These are
the steps to be followed to Upload data through CATT:
Creation of the CATT test case & recording the
sample data input. Download of the source file
template. Modification of the source file. Upload of
the data from the source file.
21.
What is Smart Forms?- Smart Forms allows
you to create forms using a graphical design tool with
robust functionality, color, and more. Additionally, all
new forms developed at SAP will be created with the
new Smart Form solution.
22.
How can I make a differentiation between
dependent and independent data?- Client
dependent or independent transfer requirements

include client specific or cross client objects in the


change requests. Workbench objects like SAPscripts
are client specific, some entries in customizing are
client independent. If you display the object list for
one change request, and then for each object the
object attributes, you will find the flag client specific.
If one object in the task list has this flag on, then that
transport will be client dependent.
23.
What is the difference between macro and
subroutine?- Macros can only be used in the
program the are defined in and only after the
definition are expanded at compilation / generation.
Subroutines (FORM) can be called from both the
program the are defined in and other programs . A
MACRO is more or less an abbreviation for some lines
of code that are used more than once or twice. A
FORM is a local subroutine (which can be called
external). A FUNCTION is (more or less) a subroutine
that is called external. Since debugging a MACRO is
not really possible, prevent the use of them (Ive
never used them, but seen them in action). If the
subroutine is used only local (called internal) use a
FORM. If the subroutine is called external (used by
more than one program) use a FUNCTION.
SELECT - join
[(] {dbtab_left [AS tabalias_left]} | join
{[INNER] JOIN}|{LEFT [OUTER] JOIN}
{dbtab_right [AS tabalias_right] ON
join_cond} [)] ... .
Joins the columns of two or more database tables in a
results set.
The syntax of join is a recursively nestable join
expression. A join expression consists of a left side
and a right side, joined using either [INNER]
JOIN or LEFT [OUTER] JOIN. A join expression can
be an inner join (INNER) or an outer join (LEFT
OUTER). You can enclose every join expression in
parentheses. When you use a join expression,

the SELECT statement is not subject to SAP


buffering.
On the left side, you can specify either
a transparent database table, a view dbtab_left, or
another join expression join. On the right side, you
must specify a single transparent database table or a
viewdbtab_right and join
conditions join_cond after ON. In this way, you can
specify a maximum of 24 join expressions
after FROM; these expressions join 25 transparent
database tables or views together. Pooledand cluster
tables cannot be joined using join expressions.
For each of the specified database tables, or for each
view, you can use AS to specify an alternative table
name tabalias. A database table or a view can exist
more than once within a join expression, and can
have various alternative names.
Results set for inner joins
In a single results set, an inner join links the columns
of the rows in the results set of the left side with the
columns of the rows in the results set of the right
side. This results set contains all combinations of
rows whose columns meet the condition join_cond. If
there are no rows in the results set of the left and
right sides
Results set for outer joins
In principle, the outer join creates the same results
set as the inner join, with the difference that, for
each selected row on the left side, at least one row is
created in the results set, even if no rows on the right
side fulfill the condition join_cond. The columns on
the right side that do not meet the
condition join_cond are filled with null values.
FICO Tables:
SKA1 Accounts

BNKA Bank master record

BKPF Accountig documents


BSEG item level
Master Data

LFB1 ( Vendor Company Code Data)


LFA1 ( Vendor General Data)

KNB1 ( Customer Company Code Data)


KNA1 (Customer General Data)

WARANTY Tables:
PNWTYH : Warranty Claim Header
PNWTYV : Warranty Claim Version
PVWTY : Warranty Claim Item
BGMK Master warranty header
BGMP Master warranty item
BGMS Text item master warranty
BGMT Master warranty text
BGMZ Warranty counter information

Purchasing Tables:

EINA Purchasing Info Record- General Data


EINE Purchasing Info Record- Purchasing Organization Data
MAKT Material Descriptions
MARA General Material Data
EBAN Purchase Requisition
EBKN Purchase Requisition Account Assignment
EKKO Purchasing Document Header
EKPO Purchasing Document Item
LFA1 Vendor Master (General section)
LFB1 Vendor Master (Company Code)

ABAP VS ABAP HR
ABAP HR forms an integral part of ABAP.

It can be said as a sub-part / sub-module of ABAP

ABAP may be related to any module of SAP like HR,


FICO, SD, MM, CRM etc. .

When it comes to ABAP HR, it is the development of


ABAP in the area of HR only.

They may be in any area of HR like in the areas of


time aspects, pay aspects, OM aspects and Self
Services like E-recruitment, ESS etc.

There is nothing much difference between ABAP and


ABAP HR; except the way we retrieve the data from
database.

In general ABAP data is stored in Tables, but coming


to ABAP HR employee data is sorted through
Infotypes.

The way we retrieve the data from infotypes is


different in ABAP HR.

In general ABAP we use Logical database very rare,


as in ABAP HR most of the programs use Logical data
base to select data from Infotypes using Get Event.

In ABAP we use Read statement to read particular


record, still in ABAP HR we do use Read statement
apart from that we have Macros and Provide
statement.

Macro is pre defined code (like function module)


which reads data from internal table (internal
infotype) based on dates.

Provide statement is like Select statement but


selects data from internal table.

Storage and access of data in HR ABAP is completely


different in ABAP HR comparing with ABAP.

We use transaction code PA20 and PA30 to maintain


data in infotypes.

PA20 is display mode and PA30 is change mode for


Employee Data.

We can create, change, display, copy, and delete in


infotypes with PA30 transaction.

For Infotypes, authorizations can be maintained at


infotype and subtype (field) level, as HR data is more
sensitive and secret.

Modules in SAP-HR
Personnel Management (PA)

Organizational Management (OM)

Time Management (PT)

Recruitment (PB)

Personnel Development (PD)

Training & Event Management (TM)

Infotype Defination:
Units of related information in the Human Resource
Management System.

Uses of Infotype:
To group related data fields together.
Maintain employee information by date.

Structures:

Infotypes are characterized by the following:


- Infotype Structure
- Data Entry
- Time-Dependent Storage of Infotype Data
Infotypes are characterized by the following:
Infotype Structure: To the user, infotypes appear as
data entry screens. They
contain whole series of
information that you enter in data fields. Data fields
concerning the same or similar subject matter are
combined into data groups or information units.
Data Entry:
You perform data entry as follows:

Your entries are automatically checked for accuracy


and against table entries.

Predefined default values help you to enter and


maintain data.

Checks and default values depend on the


employees organizational assignment. The

organizational assignment determines the relevant


information used from time recording, wage type and
pay scale structure.
Time-Dependent Storage of Infotype Data:When you
update an infotype, the old data may not be lost. Instead,
it must be retained so that past data can be evaluated.
When you update an employees personal data, the old
data is automatically time-delimited.

Standard Functions Available in ABAP HR


BAPI_EMPLOYEE_ENQUE (to lock employee)

BAPI_EMPLOYEE_DEQUE (to unlock employee)

HR_READ_INFOTYPE (to read infotype)

HR_INFOTYPE_OPERATION (to modify infotype)

RH_PM_GET_STRUCTURE (to get organization


structure)

BAPI_EMPLCOMM_CREATE (maintain communication


0105)

RH_READ_INFTY (to read OM infotypes HRP1000,


HRP1001)
RP_GET_HIRE_DATE (to get joining date)

LDB is not a real physical database. It provides access


to database tables at the runtime of the report.
LDB-Data Retrieval
Data is read from the database and made available in
main memory.
Internal tables within the program store data from
various infotypes.
LDB - Types
PNP &

PNPCE
PAP

Personnel Administration,
Time Management & Payroll

Recruitment

PCH
:
Organizational Management,
Personal
Development,
Event Management

What is the LSM workbench?


The LSMW (Legacy System Migration Workbench) is a tool
based on SAP software that supports single or periodic
data transfer from non-SAP to SAP systems (and with
restriction from SAP to SAP system). Its core functions are:

Importing legacy data from PC spreadsheet tables or


sequential files

Converting data from its original (legacy system)


format to the target (SAP) format

Importing the data using the standard interfaces of


SAP (IDoc inbound processing, Batch Input, Direct Input)

Which data can be migrated using the LSMW?

By means of standard transfer programs: a wide


range of master data (e.g. G/L accounts, customer master,
vendor master, material master, bills of material) and
transaction data (e.g. financial documents, sales orders)

By means of recording of transactions: further data


objects (if the transaction can be run in batch input mode)
Is the imported data consistent?
Yes. The data is loaded via the standard interfaces of the
applications. This will include all checks that are run for
online transactions. Invalid data will be rejected.
Are conversions carried out identically across the
applications?
Yes. The LSMW works on the principle of central (reusable)
rules. This approach guarantees that, for example, the
material number is converted in the same way
wherever the reusable rule is used for conversion.
Is an extensive knowledge of ABAP necessary to
use the LSMW?
No. The LSMW provides the main conversion techniques at
the push of a button. For complex conversions, individual
ABAP coding can be added.
Do I have to migrate table by table?
No. Business objects such as material master, customer
master, or FI document are migrated.
Can I transfer data that is on my PC?
Yes. The LSMW can read the data directly from your PC.
Only when using the periodic interface, the data has to be
on a server accessible by the SAP system.
Is the LSMW part of the standard SAP system?
It depends on the release of the SAP system:

As of SAP Web Application Server Release 6.20, the


LSMW is integrated in the SAP system. Therefore, if you

are using a SAP system of this release or higher, you use


the system-integrated LSMW 'out of the box'.

Only for releases lower than SAP Web AS 6.20, you


have to install the standalone LSMW as add-on. You can
download the LSMW as add-on from the SWDC (Software
Download Center) of the SAP Service Marketplace.
Is there an extra charge for the LSMW?
No, both the integrated and standalone LSMW versions are
free of charge to SAP's customers and partners. For an
explanation on 'integrated' versus 'standalone', see
question above.
For which sap releases is the LSMW available?
There is an LSMW available for all SAP releases. However,
it is important to make sure to use the correct LSMW
version. Newer SAP system releases (as of SAP Web AS
6.20) come with an 'integrated' LSMW. Thus, there is no
need to install an LSMW as add-on because it is already
available in the system. On the contrary, an installation of
an add-on could lead to problems in this case. Only for
releases older than SAP Web AS 6.20, it is necessary to
install the LSMW extra as add-on.The following table
contains an overview of the LSMW versions and the SAP
releases they refer to:
ABAP Performance Standards
Result
(Y, N Commen
or
ts
N/A)

Description

Run Extended syntax checks with


character literals checkbox switched on &
Code Inspector to rectify all relevant
errors and warning (e.g. Use the results
of the above checks to remove all
variables/constants etc that are declared
but are not used)
Transaction

SE30

(ABAP

Runtime

Analysis)
must
be
checked
to
measure/compare
program
performance/runtime if program has
multiple inefficient databases selects or
complicated internal table operations
Use transaction ST05 (SQL Trace) to see
what indices your database accesses are
using. Check these indices against your
where clause to assure they are
significant. Check other indices for this
table and where you have to change your
where clause to use it. Create new
indices if necessary, but do not forget to
check the impact by consulting onsite
coordinator.
TYPE (data element) command is used
while declaring the fields whenever
feasible instead of LIKE. Remember not
always the data element name matches
with the table field name
Internal Table is defined with TYPE
STANDARD TABLE OF & Work-Areas is
used instead of header lines
Global variables are minimized by
declaring local variables or by passing
variables
through
parameters
&
arguments
while
creating
internal
subroutine(s)
In SELECT statement, only the required
fields are selected in the same order as
they
reside
on
the
database
table/structure/view
For selecting single row from a database
table, SELECT UP to 1 Rows is used.
Select Single is used only when full

primary key combination is known


No SELECT * is used
Use SELECT INTO TABLE rather than
SELECT INTO CORRESPONDING FIELDS
OF TABLE
Always specify as many primary keys as
possible in WHERE clause to make the
Select efficient
Always select into an internal table,
except when the table will be very large
(i.e., when the internal table will be
greater than 500,000 records). Use Up
to N Rows when the number of records
needed is known
Select statement within a GET event is
not used
Wild cards like A% is avoided as much
as possible
Nested Select is not used instead Inner
Join and/or For all Entries is used. For
all Entries is to be used over Loop at
ITAB / Select / ENDLOOP (FOR ALL
ENTRIES retrieves a unique result set so
ensure you retrieve the full key from the
database)
When creating joins over database tables
there should be an index at least on the
inner table for the fields in the join
condition else use FOR ALL ENTRIES
select statement
Usage of JOIN is limited to a maximum of
2 i.e. not more than 3 database tables

are joined at one time


CHECK that the internal table used in
FOR ALL ENTRIES is NOT empty as this
will retrieve all entries from the table
Delete adjacent duplicate entries from
internal table before selection from
database table using FOR ALL ENTRIES
statement
For copying internal tables use =
operator instead of Looping & Appending
SORT inside a LOOP is not used
Sort internal table by fields in the correct
order, which are used in a READ TABLE
statement using BINARY SEARCH. If the
order of sorting is invalid the BINARY
SEARCH will never work
For large internal tables where only some
rows are to be processed, use SORT and
then the READ TABLE command is used
to set index to first relevant row before
looping from that index. Use CHECK or
IFEXITENDIF as appropriate to exit
from the loop
Sort fields and Sort Order on the SORT
statement should be mentioned explicitly
(e.g.
SORT
ITAB
BY
FLD1
FLD2
ASCENDING)
Hashed table is used for processing large
amount of data (provided that you access
single records only, and all with a fully
specified key)
DELETE or SORT is not used on a hashed
table
since
it
increases
memory

consumption
Sorted table is used for range accesses
involving table key or index accesses
Fields specified in the WHERE condition
with the critical operators NOT and <>
(negative SQL statements) cannot be
used for a search using database
indexes. Whenever possible formulate
SQL statements positively
When coding IF or CASE, testing
conditions are nested so that the most
frequently true conditions are processed
first. Also CASE is used instead of IF when
testing
multiple
fields
equal
to
something
LOOP AT ITAB INTO WORKAREA WHERE K
= XXX should be used instead of LOOP
AT ITAB INTO WORKAREA / CHECK ITAB-K
= XXX.
Also READ TABLE INTO WORKAREA
should be used instead of only READ
TABLE.
After the APPEND statement inside a
loop, the work area that has been
appended is cleared
Internal tables, Work areas & Global
Variables are freed when no longer
needed (e.g. using the FREE / REFRESH
command), especially when the tables
are large or the program is a batch
program
Do not delete the records of internal
table inside the Loop End loop.

Do not use: LOOP AT


EQUNR = 00001011.

ITAB

WHERE

DELETE ITAB.
ENDLOOP.
Use: DELETE
00001011.

ITAB

WHERE

EQUNR

Use the MODIFY ITAB ... TRANSPORTING


f1 f2 ... for single line, and MODIFY
ITAB ... TRANSPORTING f1 f2 ... WHERE
condition for a set of line, to accelerate
the updating of internal table
If possible, Update/Insert statement is
used instead of Modify
Is the following steps ensured during
database updates?
Lock data to be edited
Read
current
database

data

from

the

Process data and write it to the


database
Release the
beginning

locks

set

at

the

Try to avoid logical databases. If your


program uses a logical database, but
does not require all fields belonging to a
certain GET event, always use the FIELDS
addition to reduce the amount of data
selected by the logical database
Avoid the aggregate (Count, Max, Min)

functions in the database selection


Use Parallel Cursor methods for nested
loop into the internal tables if second
internal table contains considerable
number of records
In Smartform/ Sapscript do not make
redundant data retrieval where data is
available in interface

A Conversion means data that is converted from


one format to another format and from one system
to another.

So when you first implement SAP, you are actually


replacing some of your legacy systems, but you are not
completely trashing the data. You still need some of that
data from the systems that are being replaced. So you pull
the data out of your legacy systems and put them on
some files. You then want to load that data into your new
SAP system.

So during go live, you want to transfer the POs from your


legacy system to SAP. Now a PO in your legacy system
may not have the same fields as a PO in SAP. So you
convert the data.

Ex: BDC,LSMW

Interfacing is connecting two or more different


entities. In our case, it is connecting one or more
systems with SAP. Now extending our previous

example, you are replacing some legacy


applications but there are some applications that
you don't want to replace yet.

You need to somehow pass data back and forth between


SAP
and these remaining systems. Data may be going one way
or the other way or both ways. You will still need to do
some data transformations/translations etc to make the
data understandable to the receiving system.

This will continue as long as you want to keep the systems


running alongside SAP.

Ex: idoc, bapi

In short, conversions are written to load data into


SAP onetime. These are typically file based.

Interfaces are written to


exchange/update/send/receive data between SAP
and other systems on an ongoing basis. These can
be in many forms, file based, idoc based, real
time(business connector, XI etc are useful in this),
xml, and the list goes on.

SLIS:
SLIS is the predefined type-group which contains
predefined data types for Building ALV report. So when
you doing ALV , you need write this statement.

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.

Why you want to work with XYZ company??


"Well as every body knows about IBM as D best and
largest company across the globe with over 1 lac +
employees and have great work culture and gives space
to individuals to perform well and grow and give a chance
to work with latest technologies and as well as have the
best employment benefits too"
Everyone says that i will join with the company for better
career growth, this is one point. But i say learn something
new, not only from the seniors, But also from juniors.
Learning is the process which never ends. If you habituate
to learn something new wherever you go,then there is no
ending point for the growth of career.

Table Maintenance Events


The value to be displayed on the maintenance screen for
any field can also be altered as per the requirement like
for every new entry in the table one of the field should
have the constant value appearing automatically. For this

purpose, the event needs to be chosen which performs the


action. In this case event "05 creating a new entry".
List of Events available in Table maintenance
01
Before saving the data in the database
02
After saving the data in the database
03
Before deleting the data displayed
04
After deleting the data displayed
05
Creating a new entry
06
After completely performing the function 'Get
original'
07
Before correcting the contents of a selected field
08
After correcting the contents of a selected field
09
After getting the original of an entry
10
After creating the header entries for the change
task (E071)
11
After changing a key entry for the change task
(E071K)
12
After changing the key entries for the change task
(E071K)
13
Exit editing (exit main function module)
14
After lock/unlock in the main function module
15
Before retrieving deleted entries
16
After retrieving deleted entries
17
Do not use. Before print: Event 26
18
After checking whether the data has changed
19
After initializing global variables, field symbols,
etc.
20
after input in date sub screen (time-dep. tab.
/views)
21
Fill hidden fields
22
Go to long text maintenance for other languages
23
Before calling address maintenance screen
24
After restricting an entry (time-dep. tab./views)
25
Individual authorization checks
26
Before creating a list
27
After creation or copying a GUID (not a key field)
28
After entering a date restriction for time-dep.
views
IDOC Reprocessing:

Go to transaction code BD87 and enter the IDOC number,


once you execute then you will see the IDOC with the
status in the last node. Select it and click on process.
System will give you information on the new status,
whether it is processed or not.

First check IDOC in T code WE02 find out the reason in


status record why IDOC in error, after that Fix the error
and
Reprocess the IDOC in T code WE19, please confirm
whether the solution works or not.

1)smartform language translate


2)BDC structure fields.
2)what is use of ITCSY structure in SAP scrip
3)SO10 standard text RSTXTRANs standard program ,
execute it to test smartform text.
4)standard text, scrpt, process code client dependant
5)How to debug data send from legacy to sap sys
-put infinite do- enddo loop in RFC and execute SM50,
SM66 to debug background job
6)BDC sessin method function module.
<b>Call transaction:</b>
1.Synchronous Processing.
2.Synchronous and Asynchronous database updates.
3.Transfer of data for individual transaction,

4.Not suited for bulk transfer.


5.No automatic errror handling.

<b>Session:</b>
1.Asynchronous Processing.
2.Synchronous database updates.
3.Transfer of data for multiple transactions.
4.Best suited for bulk transfer.
5.Automatic errror handling.
6.SAP's standard approach for data transfer

CALL FUNCTION 'BDC_OPEN_GROUP'


perform bdc_dynpro

using 'SAPLMGMM'

'0060'.
perform bdc_field

using 'BDC_CURSOR'

'RMMG1-MTART'.

perform bdc_field

using 'BDC_OKCODE'

'/00'.

CALL FUNCTION 'BDC_INSERT'


CALL FUNCTION 'BDC_CLOSE_GROUP'

----

Start new screen

----

FORM BDC_DYNPRO USING PROGRAM DYNPRO.


CLEAR BDCDATA.
BDCDATA-PROGRAM = PROGRAM.
BDCDATA-DYNPRO = DYNPRO.
BDCDATA-DYNBEGIN = 'X'.
APPEND BDCDATA.
ENDFORM.

----

Insert field
----

FORM BDC_FIELD USING FNAM FVAL.


IF FVAL IS NOT INITIAL.
CLEAR BDCDATA.

BDCDATA-FNAM = FNAM.
BDCDATA-FVAL = FVAL.
APPEND BDCDATA.
ENDIF.
ENDFORM.

POV- function module


F4IF_INT_TABLE_VALUE_REQUEST
REUSE_ALV_POPUP_TO_SELECT - if want to display
the message in popup window after clicking on
button of ALV report.
7)Structure BDCMSGCOLL-to catch BDC error and copy it
in internal table and display using ALV
8)Function module to upload excel file?
UPLOADING EXCEL FILE IN ABAP USING
alsm_excel_to_internal_table
9)Refresh and clear

CLEAR : It will clear only Header of the internal Table.


Refresh : This always applies to the body of the table. It
will clear the Data in that internal table,but allocated
memory will
remain. (CLEAR[] is same like REFRESH)

Free : It will clear the data as well as allocated memory


for that internal table.

10)LUW
11)implicit and explicit commit- update , inert and delete
call commit implicit no need to call explicit.
12)explicit and implicit enhancementImplicit- If you are using ECC6.0 or higher please do the
following steps
take a program in se38 ..Once you are inside in the top
menu
"EDIT" -> Enhancement options -> click on Show Implicit
Enhancement options
If there is an option available we can see it highlighted in
the program which will most probably at the bottom of the
program or in function modules whereit will appear like

Explicit-goto se80-select package and enter package


name- display-click on enhancement

13)Parallel cursor method


Most common performance problem that occurs in ABAP
programs are because of huge number of records in the
internal tables. The problem complexifies if program has
huge nested internal tables. How much ever efficient data
selects routines are, data processing routines would be
contibuting significantly for the bad performance. The root
cause for the same when analysed would be revealed
that, the where condition that are used in inner loops

expend significant amount of processing time. The idea is


avoid where conditions in the inner loops by maintaining
the loop indexes manually.
Conventional Code for nested loops
Conventional Method
loop at lt_vbpa into wa_vbpa.
loop at lt_kna1 into wa_kna1 where kunnr = wa_vbpa-kunnr.
****** Your Actual logic within inner loop ******
endloop.
endloop.
Code sample: Parallel Cursor method
Preferred Method
Table:
Kna1- General Data in Customer Master
vbpa - Sales Document: Item Data
Field:
KUNNR - Customer Number
sort: lt_vbpa by kunnr, "Sorting by key is very important
lt_kna1 by kunnr. "Same key which is used for where condition is used
loop at lt_vbpa into wa_vbpa.
read lt_kna1 into wa_kna1
" This sets the sy-tabix
with key kunnr = wa_vbpa-kunnr
binary search.

if sy-subrc = 0.
"Does not enter the inner loop
v_kna1_index = sy-tabix.
loop at lt_kna1 into wa_kna1 from v_kna1_index. "Avoiding Where clause
if wa_kna1-kunnr <> wa_vbpa-kunnr. "This checks whether to exit out
exit.
endif.
****** Your Actual logic within inner loop ******
endloop. "KNA1 Loop
endif.
endloop. " VBPA Loop

14)For binary search it should be always


be sorted inASCENDING
15)In reporting the PBO is AT SELECTION-SCREEN
OUTPUT. and the PAI is AT SELECTION-SCREEN.

Simplest way to use std texts in smartforms.


goto so10 and create ur text.
in the smartform, Include the text element in the plate
text window under general Attributes in create text field

Ex:

Attributes in create text field


Text Name: Z_CONTRACT_BOILERPLATE
Text Object: TEXT
Text Id: ST
Language: EN

In Text Node
In Type Field select Include Text
Then u can see
Text Name
Text Object
Text ID
Language
Comparing Strings
Similarly to the special statements for
processing strings, there are special comparisons that you
can apply to strings with types C, D, N, and T. You can use
the following operators:
<operator>

Meaning

CO

Contains Only

CN

Contains Not only

CA

Contains Any

NA

contains Not Any

CS

Contains String

NS

contains No String

CP

Matches pattern

NP

Does not match pattern

There are no conversions with these comparisons. Instead,


the system compares the characters of the string.

Field Symbols:
Generally, we use the explicit work area to process the
internal table like appending & modifying records. We can
reduce the time and improve the performance of the
program by using the field-symbols. When we use the
LOOP construct with the explicit work area, system need
to engage the resources to put the required record in the
work area, process it and move it back to the table if the
needed. This additional processing time could be saved by
using the field-symbol. By using the field-symbols we can
save this additional time and improve the performance.
Field-symbols 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. A field symbol cam point to any data
object. The data object to which a field symbol points is
assigned to it after it has been declared in the program.

DATA: itab TYPE STANDARD TABLE OF char1,


wa TYPE char1.
FIELD-SYMBOLS: <wa> TYPE char1.

work area:
LOOP AT ITAB INTO WA.
WA-FLAG = 'X'.
MODIFY ITAB FROM WA.
ENDLOOP.

Runtime: 755 microseconds

Field Symbols;
LOOP AT ITAB ASSIGNING <WA>.
<WA>-FLAG = 'X'.
ENDLOOP.
Runtime: 91 microseconds

You might also like