ABAP中,字段名存放在一个变量里,如何取内表的这个字段值?

2024-12-05 04:47:41
推荐回答(1个)
回答1:

DATA name(5) TYPE c.
DATA it_p0000 LIKE TABLE OF p0000.
DATA wa_p0000 TYPE p0000.
name = 'PERNR'.
以上是你的代码

FIELD-SYMBOLS TYPE p0000-pernr.

取数我就不写了

LOOP AT it_p0000 INTO wa_p0000.
ASSIGN COMPONENT name OF STRUCTURE wa_p0000 TO .
WRITE: / .
ENDLOOP.

就是你要的

PS: name = 'PERNR' 注意要大写