Wednesday, May 26, 2010

ABAP internal table2

The index Addition on the read table Statement Locates a Single Row by Its Relative Row Number

1 report ztx1106.
2 data: begin of it occurs 3,
3 f1(2) type n,
4 f2 type i,
5 f3(2) type c,
6 f4 type p,
7 end of it,
8 wa like it.
9
10 it-f1 = '10'. it-f3 = 'AA'. it-f2 = it-f4 = 1. append it.
11 it-f1 = '20'. it-f3 = 'BB'. it-f2 = it-f4 = 2. append it.
12 it-f1 = '30'. it-f3 = 'CC'. it-f2 = it-f4 = 3. append it.
13
14 read table it index 2.
15 write: / 'sy-subrc =', sy-subrc,
16 / 'sy-tabix =', sy-tabix,
17 / it-f1, it-f2, it-f3, it-f4.
18
19 read table it into wa index 1.
20 write: /,
21 / 'sy-subrc =', sy-subrc,
22 / 'sy-tabix =', sy-tabix,
23 / it-f1, it-f2, it-f3, it-f4,
24 / wa-f1, wa-f2, wa-f3, wa-f4.
25
26 read table it index 4.
27 write: /,
28 / 'sy-subrc =', sy-subrc,
29 / 'sy-tabix =', sy-tabix,
30 / it-f1, it-f2, it-f3, it-f4,
31 / wa-f1, wa-f2, wa-f3, wa-f4.

No comments:

Post a Comment

Blog Archive