Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Transform osreftab to internal table

Hello,

I have a table of type osreftab that I have gott from an persistance object using

if_os_ca_persistency~get_persistent_by_query

Is it possible to dynamically convert this into an internal table?

i.e. I would prefer something like

DATA: result_table TYPE osreftab,

           tmp_result TYPE object,

           ls_row TYPE some_internal_table.

result_table = agent->if_os_ca_persistency~get_persistent_by_query( some_Query ).

LOOP AT result_table INTO tmp_result.

     ls_row = *convert tmp_result to ls_row dynamically*

     APPEND ls_row TO lt_row.

ENDLOOP.

instead of:

DATA: result_table TYPE osreftab,

           tmp_result TYPE object,

.          ls_row TYPE some_internal_table,

          tmp_row TYPE REF TO ZCL_PERSISTENT_CLASS.


result_table = agent->if_os_ca_persistency~get_persistent_by_query( some_Query ).

LOOP AT result_table INTO tmp_result.

     tmp_row ?= tmp_result.

     ls_row-field_a = tmp_row->get_field_a( ).

     ls_row-field_b = tmp_row->get_field_b( ).

     ls_row-field_c = tmp_row->get_field_c( ).

     APPEND ls_row TO lt_row.

ENDLOOP.

Regards

Mattias

Tags:
Not what you were looking for? View more on this topic or Ask a question