Improving Internal Table Performance Flashcards

1
Q

How can you sort a standard internal table?

A

You can sort a standard internal table using the SORT statement.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What statement is used to remove duplicate entries from an internal table?

A

The DELETE ADJACENT DUPLICATES statement is used to remove duplicate entries from an internal table.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

When using DELETE ADJACENT DUPLICATES, what must you do before?

A

Before using DELETE ADJACENT DUPLICATES, you must sort the internal table according to the columns that you want to screen for duplicate values.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What does the COMPARING addition of DELETE ADJACENT DUPLICATES do?

A

The COMPARING addition of DELETE ADJACENT DUPLICATES allows you to specify which fields to consider when identifying duplicate entries, instead of considering all key fields by default.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is the purpose of table comprehensions in ABAP?

A

To transfer data between identical fields of two internal tables. You can read data from more than one source to fill your target table and use expressions to calculate values.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

How does the CORRESPONDING operator work in ABAP table comprehensions?

A

To transfer data between identical fields of two internal tables, employ the CORRESPONDING operator. Like with structures, it creates new rows in the target table for each source row and copies data between matching fields. Unmatched fields are disregarded, with target fields without a match receiving type-specific initial values.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

In ABAP, how can you use a FOR expression in a table comprehension?

A

In ABAP, a FOR expression in a table comprehension iterates over a source table, assigning values to columns of the target table based on each row of the source.
You can use FROM and WHERE to specify the results.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What are some benefits of using table comprehensions in ABAP programming?

A

Table comprehensions in ABAP offer benefits like simplifying code, improving efficiency, enhancing maintainability, and enabling flexible data processing within internal tables.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What is a reduction in the context of iterating over an internal table in ABAP?

A

A reduction in ABAP involves summarizing information from an internal table, such as producing a sum or row count, using the INIT and NEXT expressions.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

How does a reduction work in ABAP when computing a sum?

A

In ABAP, for computing a sum using a reduction, the INIT part initializes a variable (e.g., total), and the NEXT expression iterates over the internal table, adding values from each row to the variable.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Can a reduction in ABAP return a structured type as a result?

A

Yes, for instance, a reduction can compile sums of different components across the entire internal table.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What is the requirement for the target variable and the result type in a REDUCE expression in ABAP?

A

The target variable and the result type in a REDUCE expression must be compatible. They should have matching types to ensure proper assignment of the reduction result.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What is a field symbol in ABAP?

A

a pointer that allows direct access to the memory address of an object, such as a line of an internal table, without the need to copy it into a work area.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

How does using a field symbol differ from using a work area when processing an internal table in ABAP?

A

a field symbol allows direct manipulation of the table line without copying it into a work area. This eliminates the need to copy changes back into the internal table, improving performance.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

How do you define a field symbol in ABAP?

A

you define a field symbol using the FIELD-SYMBOLS statement, followed by a name enclosed in angled brackets, and assign a type to it. Typically, the type assigned to a field symbol is the line type of the internal table it will be used with.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

How do you use a field symbol in a loop over an internal table in ABAP?

A

you use the ASSIGNING addition in the LOOP statement to assign the field symbol to each line of the internal table iteratively. Within the loop, you can then manipulate the contents of the table line directly using the field symbol.

17
Q

What is one advantage of using field symbols over work areas when processing large internal tables in ABAP?

A

One advantage of using field symbols over work areas in ABAP is improved performance, as field symbols allow direct access to internal table lines without the need for data copying operations. This reduces memory and processing overhead.

18
Q

What is a sorted table in ABAP?

A

a sorted table is an internal table where the contents are always sorted according to the key fields in ascending order. When inserting a new record, the system ensures it is placed in the correct position.

19
Q

How does a sorted table optimize read accesses compared to a standard table in ABAP?

A

A sorted table optimizes read accesses in ABAP by maintaining its contents sorted, allowing the system to retrieve records more efficiently. It eliminates the need for sequential search, improving performance.

20
Q

What is a hashed table in ABAP?

A

a hashed table is an internal table managed using a special hash algorithm. This algorithm enables the system to retrieve records quickly, even with large tables, but its performance gain is limited to specific cases.

21
Q

How is a sorted table being accessed?

A

Through a binary search. The system jumps to the middle of the table and checks if the searched for value is bigger or smaller than the jumped to value. If it is smaller, the lower half gets ignored and the system jumps to the middle value of the upper half and repeats the process.

22
Q

How are hashed tables being accessed?

A

The system builds a hash value from the key values, also called the pointer. The pointers are stored in the hash table. The rows of the hash table however are not stored in table form, but are instead spread across a memory block. Index aceess is therefore not possible.

23
Q

How can you speed up access to an internal table in ABAP using fields that are not part of the primary key?

A

you can add one or more secondary keys to the definition of the internal table.

24
Q

What are the characteristics of secondary keys in ABAP internal tables?

A

secondary keys of internal tables can be either sorted or hashed. Similar to primary keys, a sorted secondary key may be either unique or non-unique, while a hashed secondary key must always be unique.

25
Q

What is the difference between non-unique and unique secondary keys in ABAP internal tables?

A

In ABAP internal tables, a non-unique secondary key is created by the system only when the program accesses the table using the key for the first time, incurring extra runtime costs. However, subsequent read accesses are faster. In contrast, a unique secondary key ensures that the key combination of all rows in the table is unique and requires the system to always keep the key up to date.

26
Q

How does the system handle changes to the contents of an internal table with secondary keys in ABAP?

A

any operation that changes the contents of an internal table with secondary keys leads to the index being either created (for first access) or updated (for subsequent accesses). Read accesses are always fast because the secondary index is already up to date.

27
Q

What is the purpose of using a unique secondary key in ABAP internal tables?

A

a unique secondary key serves two purposes: to speed up access to the table and to ensure that the key combination of all rows in the table is unique.

28
Q

Which of the following can you use to copy data from one internal table to another?

A
The UPDATEstatement

B
A table comprehension with VALUE #( )

C
The CORRESPONDING #( )operator

D
The SELECT statement.

A

B
A table comprehension with VALUE #( )

C
The CORRESPONDING #( )operator

29
Q

You want to read data from an internal table using some, but not all, of its key fields. The fields you want to use are at the beginning of the key with no gaps. What kind of internal table is suitable

A
Sorted table

B
Standard table

C
Hashed table

A

A
Sorted table

30
Q

When reading data from a standard table, you can improve the response time by specifying the full table key.

A

False

31
Q

You are using the DELETE ADJACENT DUPLICATES statement. Which of the following statements about the COMPARING addition are true?

A
It will only work properly if the table has been sorted according to the same columns as are listed after COMPARING.

B
If you leave it out, the entire line must be the same in order to be considered a duplicate

C
If you leave it out, the key fields of the table row must be the same in order to be considered a duplicate.

D
It is mandatory.

A

A
It will only work properly if the table has been sorted according to the same columns as are listed after COMPARING.

C
If you leave it out, the key fields of the table row must be the same in order to be considered a duplicate.

32
Q

In a loop that processes an internal table and modifies the contents, you replace a work area with a field symbol. What do you expect to happen to the performance of the loop?

A
The field symbol is faster than the work area.

B
The work area is faster than the field symbol.

C
The performance of both techniques is equal.

A

A
The field symbol is faster than the work area.

33
Q

You read data from an internal table with a secondary key. Which of the following statements is true?

A
The runtime system determines whether the secondary key should be used.

B
If you want the system to use the secondary key, you must specify this in your read access.

A

B
If you want the system to use the secondary key, you must specify this in your read access.