For internal tables we also have the option to use the CLEAR command and 2 options more: REFRESH and FREE. Let's show how they work with an example:
TYPES: BEGIN OF ty_data, matnr TYPE matnr, value(5) TYPE n, erdat TYPE erdat, END OF ty_data. DATA: it_data TYPE STANDARD TABLE OF ty_data, wa_data LIKE LINE OF it_data, lv_count type i. DO 10 TIMES. wa_data-matnr = sy-index. wa_data-value = '01'. wa_data-erdat = sy-datum. APPEND wa_data TO it_data. ENDDO. DESCRIBE TABLE it_data LINES lv_count. " Variable lv_count has the value 10 CLEAR it_data[]. " This will initialize all the content of table including the table header REFRESH it_data. " This will initialize all the content of table but not the table header FREE it_data. " This will initialize all the content of table including the table header and will release from memory the table
Serkan AKKAVAK Computer Engineer ABAP Developer & SAP S/4 HANA Logistics Team Lead Contact : serkurumsal@yandex.com
Social Plugin