如何仅在 Table 处循环引用数据
How to loop at Table only having ref to data
我正在使用函数模块 RSAQ_QUERY_CALL
,返回 table:
DATA: gr_data TYPE REF TO data.
CALL FUNCTION 'RSAQ_QUERY_CALL'
EXPORTING
query = 'ZXXXXXXXX'
usergroup = 'XXX'
VARIANT = 'TEST'
SKIP_SELSCREEN = 'X'
DATA_TO_MEMORY = 'X'
IMPORTING
ref_to_ldata = gr_data
EXCEPTIONS
OTHERS = 11.
现在我该如何循环 table?
我尝试了什么:
- 分配给字段符号
- 传递字段符号而不是 dref
两者均无效。
我找到了解决办法(问了前辈..)
FIELD-SYMBOLS: <gt_data> type table,
<row> type any.
ASSIGN gr_data->* to <gt_data>.
LOOP AT <gt_data> ASSIGNING <row>.
DO.
ASSIGN COMPONENT sy-index OF STRUCTURE <row> TO <field>.
IF sy-subrc <> 0.
EXIT. " last field of row
ENDIF.
WRITE : / 'Field', sy-index, ':', <field>.
ENDDO.
ENDLOOP.
参考这段代码:
FIELD-SYMBOLS: <gt_data> type table,
<fs_value> type any.
ASSIGN gref_data->* to <gt_data>.
LOOP AT <gt_data> ASSIGNING <fs_value>.
write:<fs_value>. "Here you will get row by row
ENDLOOP.
我正在使用函数模块 RSAQ_QUERY_CALL
,返回 table:
DATA: gr_data TYPE REF TO data.
CALL FUNCTION 'RSAQ_QUERY_CALL'
EXPORTING
query = 'ZXXXXXXXX'
usergroup = 'XXX'
VARIANT = 'TEST'
SKIP_SELSCREEN = 'X'
DATA_TO_MEMORY = 'X'
IMPORTING
ref_to_ldata = gr_data
EXCEPTIONS
OTHERS = 11.
现在我该如何循环 table?
我尝试了什么:
- 分配给字段符号
- 传递字段符号而不是 dref
两者均无效。
我找到了解决办法(问了前辈..)
FIELD-SYMBOLS: <gt_data> type table,
<row> type any.
ASSIGN gr_data->* to <gt_data>.
LOOP AT <gt_data> ASSIGNING <row>.
DO.
ASSIGN COMPONENT sy-index OF STRUCTURE <row> TO <field>.
IF sy-subrc <> 0.
EXIT. " last field of row
ENDIF.
WRITE : / 'Field', sy-index, ':', <field>.
ENDDO.
ENDLOOP.
参考这段代码:
FIELD-SYMBOLS: <gt_data> type table,
<fs_value> type any.
ASSIGN gref_data->* to <gt_data>.
LOOP AT <gt_data> ASSIGNING <fs_value>.
write:<fs_value>. "Here you will get row by row
ENDLOOP.