关于sap abap 中的指针的使用,写了一个小程序。
REPORT ZJAMIE_TEST.
DATA: BEGIN OF t_mara OCCURS 0,
matnr type matnr,
MTART type MTART,
MAKTX type MAKTX,
END OF t_mara.
data: BEGIN OF t_makt OCCURS 0,
matnr type matnr,
maktx TYPE maktx,
END OF t_makt.
data:v_tabix type SYTABIX.
* 指针定义
FIELD-SYMBOLS: <TAB> TYPE ANY,
<FIELD> TYPE ANY.
SELECT MATNR
MTART
INTO TABLE t_mara
FROM MARA
UP TO 10 ROWS.
LOOP AT T_MARA.
ASSIGN T_MARA TO <TAB>.
WHILE SY-SUBRC = 0.
ASSIGN COMPONENT SY-INDEX OF STRUCTURE <TAB> TO <FIELD>.
IF SY-subrc = 0.
WRITE / <FIELD>.
ENDIF.
ENDWHILE.
SY-subrc = 0.
ENDLOOP.