通过一个简单的ABAP报表窥探ABAP内存分配和管理机制
REPORT zhelloworld. PARAMETERS: clear TYPE c as CHECKBOX DEFAULT abap_false. TYPES: tt_table TYPE TABLE OF tadir WITH KEY pgmid object. DATA: lt_result TYPE TABLE OF tadir, lt_total TYPE TABLE OF tadir, lr_result TYPE REF TO tt_table. DATA: c1 TYPE cursor. OPEN CURSOR @c1 FOR SELECT * FROM tadir. DO. WRITE: / |Round: { sy-index } | COLOR COL_NEGATIVE. CREATE DATA lr_result. FETCH NEXT CURSOR @c1 INTO TABLE @lr_result->* PACKAGE SIZE 800000. IF sy-subrc <> 0. EXIT. ENDIF. APPEND LINES OF lr_result->* TO lt_total. cl_abap_memory_utilities=>get_memory_size_of_object( EXPORTING object = lt_total