Internal Table
Internal Table
When an internal table is created, what are the setting criteria for the value of occur?
The objective of setting the value of an occurrence for an internal table is a question of optimization. The following facts
should be taken into account when making such decision:
1) The complete data area of a program is 64000 bytes.
2) The initial size declared is kept in roll area (quicker access to program)
3) Data entered that exceeds the initial size stores in the roll file (Slower access to program)
You should also analyze the expected volume and access rates before making the decision.
What is the main difference between work area and header line?
The functionality of Work area or Header line is same. I.e. they let us to work with the body of internal table. The default
work area for internal table is Header Line. The difference is, Header line is created by default when we create the
Internal table using "begin of" or explicitly “with header line". Work area should have the same structure as that of
internal table. It should be created by us, where as the header line is created automatically by any one of the above
statements. Note: when you create an internal table using the following statement:
Begin of IT_vbak occurs 10 without header line.
This will not create Header line.
What is the difference between Internal table with header line and with out header line?
Internal table with header line doesn’t need an explicit work area. Without header line, table needs an explicit work
area.
What should be declared explicitly in the corresponding ABAP/4 Statements to access internal tables without header
lines & why?
Work Area. This is required as the Work Area is the interface for transferring data to and from the table.
What do you get when you refer to a client-specific transparent table in the Dictionary if you have a data definition
with TABLES? (TRUE/FALSE)
A structured work area (line). T
A field. F
An internal table. F
An internal table type is defined using the ____________ statement whereas an internal table object is created using
the _____________ statement.
TYPES, DATA.
How is the read/write operation done on an internal table with header line?
When filling an internal table with a header line, you place the data in the header line. Using the corresponding
statements, the contents of the header line is transferred to the table. When reading the internal table, the ABAP/4
runtime system places the contents of the read table line in the header line.
What is the difference between standard and sorted internal tables? (In performance wise)
Sorted table improve the performance in case of a huge table which has large number of records.
What the differences are between hashed & sorted internal tables?
Sorted internal table works on Binary Search and Hashed internal tables works on hashed algorithm.
Which statements are allowed if you are working with an internal table of the type SORTED? (TRUE/FALSE)
SORT. F
APPEND. F
MODIFY. F
COLLECT. T
READ. T
INSERT. T
In case of internal tables, where user-defined key is used to differentiate between unique and non-unique keys?
Additional records with the same key would be permitted in case of the non-unique keys.
What is the difference between Select Single * from <table name> & select Upto n rows?
The 'SELECT SINGLE' statement selects the first row in the database that it finds that fulfils the 'WHERE' clause and puts
it in to the work area of the internal table. If this results in multiple records then only the first one will be returned and
therefore may not be unique. The 'SELECT .... UP TO n ROWS' (where n stands for an integer number) statement is subtly
different. The database selects all of the relevant records that are defined by the WHERE clause or lack of, applies any
aggregate, ordering or grouping functions to them, but writes only the specified number of rows specified by the n into
the internal table. If it is given as up to 1 rows then only 1 row is written in to the internal table.
What is the command to be used to transfer the data from one internal table to another internal?
Take there is two internal tables - itab1 and itab2.
Move-corresponding itab1 to itab2.
Move itab1 to itab2.
itab2 = itab1
If an internal table is created using the initial size addition then what problem is faced while using the statement
APPEND <internal table> SORTED BY <field>?
Number of entries in the table exceeding the initial size clause is deleted.
Differentiate between the CLEAR, REFRESH and FREE internal table statements.
CLEAR Statement initializes all fields in the header line.
REFRESH Statement deletes all table lines but the storage space is not released and header line remains unchanged.
FREE Statement releases the storage space for the table and the header line remains unchanged.
The CLEAR <field> statement sets a field back to its default value. (True/False)
False.
Name the ABAP/4 key word, which is used to clear the Header line of an Internal Table.
CLEAR <itab>.
Name the ABAP/4 key words to initialize an Internal Table with and without header line.
REFRESH <itab>.
In an ABAP/4 program how do you access data that exists on a presentation server vs. on an application server?
For presentation server use UPLOAD or WS_UPLOAD function modules.
For application server use OPEN DATASET, READ DATASET and CLOSE DATASET commands.
What is the difference between ‘Upload’, ‘Ws_uplaod’ and ‘Gui_upload’ function module?
Upload Ws_upload Gui_upload
Uploading file from Uploading file from Uploading file from presentation
presentation server to internal presentation server to internal server to internal table without the
table with use of dialog. table without the use of dialog. use of dialog.
The only required parameter is The required parameters are The required parameters are
‘DATA_TAB’ parameter. ‘FILENAME’, ‘FILETYPE’ & ‘FILENAME’ & ‘DATA_TAB’
‘DATA_TAB’ parameter. parameter.
Name the function modules to write data from an Internal Table to the Presentation Server.
DOWNLOAD and WS_DOWNLOAD.
Name the function modules to read data from Presentation Server into an Internal Table.
UPLOAD and WS_UPLOAD.
Name the function module that can be used to give information about files on Presentation Server and about its
Operating System.
WS_QUERY.
How do you read selected lines of database table into an internal table in packages of predefined size?
SELECT * FROM <SPFLI> INTO TABLE <ITAB> PACKAGE SIZE <N>.
Where 'N' is variable.
Name the WILDCARD characters which are used for comparisons with character strings & numeric strings.
'%' and '_'.
Is SELECT a loop?
Yes.
How we format the data before write statement in report? What are control break statements?
We can format the reports output by using the loop events, which are called control break statements. These are used
to execute a set of code within the Loop and Endloop. These statements are:
AT FIRST…..ENDAT: Used for Main Heading.
AT LAST…..ENDAT: Used for Grand Total.
AT NEW <Field> …..ENDAT: Used for Sub Heading.
AT END OF <Field> …..ENDAT: Used for Sub-total.
ON CHANGE OF <Field>…..ENDAT: Used for separating table on change of value for specified <field>.
What is the main point while using control break in internal table?
For calculations purpose like sub-total, grand total. When you are using control break commands, internal table must be
sorted with key field and control-break commands must be used in between the LOOP and ENDLOOP only.
If we use control break statement in between SELECT and ENDSELECT, will it execute?
No.
What is the syntax for specifying database table name at runtime in SELECT statement?
NAME = 'SPFLI'.
SELECT * FROM (NAME).
--------------
--------------
ENDSELECT.
How to insert all lines from an internal table into a database table?
Insert <database table> from table <internal table>
Name the ABAP/4 key words, which are used to change the contents of database table.
UPDATE or MODIFY.
What does an EXEC SQL statement do in ABAP? What is the disadvantage of using it?
To use a Native SQL statement, it must be preceded by an EXEC SQL statement and concluded by an ENDEXEC
statement.
Syntax: EXEC SQL
[Native SQL statements]
ENDEXEC.
Disadvantages are:
An ABAP/4 program with Native SQL statements does not generally run with different databases.
Syntax check is not done to statements written inside the EXEC SQL statements.
Which transaction code can be used to analyze the performance of ABAP Program?
AL21.
While running a report it takes long time for execution. What steps will you do to reduce the execution time? What is
runtime analysis? Have you used this?
Open the report in SE38.
Go to Utilities -> More Utilities -> Runtime Analysis.
Select the ‘Program’ Radio-button and give the report name there and click the ‘execute’ button.
It will take you to another Screen. There you can execute your report and come back.
Click on ‘Analyze’ button, present at the bottom of the Screen.
Then you will get one graph. If it is ‘Red’ then your report is having very poor performance and if it is ‘Green’ then it
is alright.
There are two types of Graph: ABAP GRAPH (For Report) and DATABASE GRAPH (Retrieving data from database in a
report).