Wednesday, May 26, 2010

ABAP internal table

"" This Program Is Like Listing 11.4, but Only Some of the Rows Are Read

1 report ztx1105.
2 data: begin of it occurs 3,
3 f1(1),
4 f2(2),
5 end of it.
6 it-f1 = 'A'.
7 it-f2 = 'XX'.
8 append it.
9 it-f1 = 'B'.
10 it-f2 = 'YY'.
11 append it.
12 it-f1 = 'C'.
13 append it. "it now contains three rows
14
15 loop at it where f2 = 'YY'. "f2 is right, it-f2 would be wrong here
16 write: / sy-tabix, it-f1, it-f2.
17 endloop.
18 skip.
19
20 loop at it to 2. "same as: loop at it from 1 to 2.
21 write: / sy-tabix, it-f1, it-f2.
22 endloop.
23 skip.
24
25 loop at it from 2. "same as: loop at it from 2 to 3.
26 write: / sy-tabix, it-f1, it-f2.
27 endloop.
28 skip.
29
30 loop at it from 2 where f1 = 'C'.
31 write: / sy-tabix, it-f1, it-f2.
32 endloop.

No comments:

Post a Comment

Blog Archive