REPORT zjason_test2 .
DATA: BEGIN OF s1 OCCURS 0,
id TYPE i,
sqr TYPE i,
END OF s1.
DATA itab1 LIKE s1 OCCURS 20 WITH HEADER LINE.
DATA itab2 LIKE s1 OCCURS 20 WITH HEADER LINE.
DATA: wa LIKE LINE OF s1.
DO 2 TIMES.
itab1-id = sy-index.
itab1-sqr = sy-index ** 2.
APPEND itab1.
ENDDO.
itab2-id = 1.
itab2-sqr = 9999.
APPEND itab2.
READ TABLE itab1 WITH KEY id = 1.
IF sy-subrc = 0.
READ TABLE itab2 WITH KEY id = itab1-id.
IF sy-subrc = 0.
itab2-sqr = itab1-sqr.
MODIFY itab2 INDEX sy-tabix. “注意很多时候都会更改sy-tabix等系统变量,应用要小心
ENDIF.
ENDIF.
LOOP AT itab2 INTO s1.
WRITE : / s1-id,s1-sqr.
ENDLOOP.
CLEAR itab2.
阅读(1377) | 评论(0) | 转发(0) |