- CLEAR => Initialize the content and remain the allocated initial memory space, BUT,
- because SAP allows using internal table(itab) with header line (enable you refer to structure and internal table with the same name). CLEAR itab will only clear the header line not the table body. => clear the content of the structure.
- To clear the table content, you need to use CLEAR itab[].
- IF you declared it without header line (for instance, DATA lt_itab TYPE STANDARD TABLE OF ever) CLEAR itab will clear the table content.
- REFRESH => similar as CLEAR, but REFRESH always refer to internal table content (table body). Thus, REFRESH itab = CLEAR itab[].
- FREE => similar to REFRESH, always refer to internal table content, but it does one more thing, it release the initial memory space allocated for the table body (table header is still exists). When you try to fill in value to internal table again, new memory space will be allocated for the table body.
C1/Case 1: DATA: itab TYPE STANDARD TABLE OF ever. | |||||
C2/Case 2: DATA: itab TYPE ever OCCURS 0 WITH HEADER LINE. | |||||
How to Initialize table content | Refer to Work Area / Structure | Refer to Table Content / Table Body | Release Table Header Memory Space | Release Table Body Memory Space | |
CLEAR | C1: CLEAR itab C2: CLEAR itab[] | C1: ✘ C2: CLEAR itab. | C1: ✔ C2: CLEAR itab[] | ✘ | ✘ |
REFRESH | REFRESH itab | ✘ | ✔ | ✘ | ✘ |
FREE | FREE itab | ✘ | ✔ | ✘ | ✔ |
Summarized from: Initializing Internal Tables.
Great.
ReplyDeleteThanks a lot.
Very good and comprehensive abstract!
ReplyDeleteThank you.
The information provided here is of great use as I got to learn new things. Keep blogging.
ReplyDeleteSAP ABAP TRAINING IN HYDERABAD
Great Post. The information provided is of great use as I got to learn new things. Keep Blogging.
ReplyDeleteSAP ABAP TRAINING IN HYDERABAD