How to loop at Table only having ref to data

爷,独闯天下 提交于 2019-12-08 12:46:19

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!