Which of the following statements are correct?

Exhibit:

Which of the following statements are correct? Note: There are 2 correct answers to this question.
A . FOR defines a loop that runs over the content of source_itab
B . source_itab is only visible within the loop.
C . row is a predefined name and cannot be chosen arbitrarily.
D . row is only visible within the loop.

Answer: A, D

Explanation:

The code snippet in the image is an example of using the FOR statement to create an internal table with a constructor expression. The FOR statement introduces an iteration expression that runs over the content of source_itab and assigns each row to the variable row. The variable row is then used to populate the fields of target_itab12. Some of the correct statements about the code snippet are: FOR defines a loop that runs over the content of source_itab: This is true. The FOR statement iterates over the rows of source_itab and assigns each row to the variable row. The iteration expression can also specify a range or a condition for the loop12.

row is only visible within the loop: This is true. The variable row is a local variable that is only visible within the scope of the iteration expression. It cannot be accessed outside the loop12. You cannot do any of the following:

source_itab is only visible within the loop: This is false. The variable source_itab is not a local variable that is defined by the FOR statement. It is an existing internal table that is used as the data source for the iteration expression. It can be accessed outside the loop12.

row is a predefined name and cannot be chosen arbitrarily: This is false. The variable row is not a predefined name that is reserved by the FOR statement. It is a user-defined name that can be chosen arbitrarily. However, it must not conflict with any existing names in the program12.

Reference: 1: FOR – Iteration Expressions – ABAP Keyword Documentation – SAP Online Help 2: ABAP 7.4 Syntax – FOR Loop iteration | SAP Community

Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments