问题
I am using the function Module RSAQ_QUERY_CALL
, getting back a 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
.
Now how can I loop at that table? What I tried:
- assign to a filed-symbol
- passing a field-symbol instead of dref
Both did not work.
回答1:
I found the solution (after asking the senior dev..)
FIELD-SYMBOLS: <gt_data> type table,
<fs_value> type any
.
ASSIGN gr_data->* to <gt_data>.
LOOP AT <gt_data> ASSIGNING <fs_value>.
ENDLOOP.
回答2:
Refer this code:
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.
来源:https://stackoverflow.com/questions/39331010/how-to-loop-at-table-only-having-ref-to-data