statement. This statement restores an internal table to the state it was in immediately after you declared it. This means that the table contains no lines. However, the memory already occupied by the memory up until you cleared it remains allocated to the table.
If you are using internal tables with header lines, remember that the header line and the body of the table have the same name. If you want to address the body of the table in a comparison, you must place two brackets ([ ]) after the table name.
To ensure that the table itself has been initialized, you can use the
statement. This always applies to the body of the table. As with the CLEAR statement, the memory used by the table before you initialized it remains allocated. To release the memory space, use the statement
REFRESH and CLEAR are the various methods for initializing Internal Tables.
If <itab> is not having header line, this will clear the entire contents.
If <itab> is having header line, this statement will just clear the contents of header line.
If <itab> has header line, this will clear the body contents ( excluding header line)
This statement will cause the body content to be cleared. But memory allotted to the table will remain as it is.. Then u have to use
FREE<itab> to free the memory.
Just check this link...
Replace always clears the body of itab,clear clears the header line when that internal table is declared with header line,if not means that internal table is not defined with header line then it clears body.If you want to clear body then you need to code it like CLEAR ITAB.
refresh itab: The internal table itab is reset to its initial state, i.e. all table entries are deleted.
clear itab: only clears the contents of the internal table.The header entry of a table with a header line remains unchanged. It can be reset to its initial value
hope this helps,
clear itab - clears only header line
refresh itab- clears body of the internal table
Free itab - clears a internal table from memory
it deletes the internal table from the memory itself
CLEAR ITAB does the same thing as REFRESH ITAB.
You can use FREE to initialize an internal table and release its memory space without first using the REFRESH or CLEAR statement.
Like REFRESH, FREE works on the table body, not on the table work area.
After a FREE statement, you can address the internal table again. It still occupies the amount of memory required for its header (currently 256 bytes). When you refill the table, the system has to allocate new memory space to the lines.
it is better practice to use the FREE ITAB command whenever possible as it will maximise system resources.
If you free the memory allocated to this internal table, the memory could be allocated to another program or another data object in the same program.
chk this link
also refer to this link for more information..
When CLEAR itab references an internal table itab with a header line, it only resets the subfields in the header entry to their initial values (as mentioned above). The individual table entries remain unchanged.
To delete the entire internal table together with all its entries, you can use <b>CLEAR itab</b> or <b>REFRESH itab.</b>
REFRESH - Delete an internal table
1. REFRESH itab.
2. REFRESH itab FROM TABLE dbtab.
3. REFRESH itab FROM SELECT-OPTIONS.
The internal table itab is reset to its initial state, i.e. all table entries are deleted.
Der Return Code SY-SUBRC is undefined.
The header entry of a table with a header line remains unchanged. It can be reset to its initial value using CLEAR.
FREE itab can be used to free up the memory allocated to the table.
The runtime required to reset an internal table depends on the amount of memory previously occupied by that table.
Resetting a small internal table takes around 15 msn (standard microseconds). Resetting a 200 KB table takes around 400 msn, and a 1 MB table, around 3000 msn.
If the internal table has an index or a hash table (because it was edited using INSERT, DELETE, SORT or COLLECT), the runtime increases slightly, since the index or hash table has to be released as well as the table itself.
REFRESH itab FROM TABLE dbtab.
In some cases, the syntax rules that apply to Unicode programs are different than those for non-Unicode programs. See Key Specifications and Unicode.
This variant is not allowed in an ABAP Objects context. See REFRESH FROM not Allowed.
This variant is no longer maintained and should no longer be used (see also obsolete key words). Please use the SELECT ... INTO TABLE statement instead.
The internal table itab is deleted and it is then filled with the contents of the database table dbtab.
A generic argument can be used to specify a restriction to a particular part of the database table when filling (LOOP AT dbtab, READ TABLE dbtab).
The table dbtab must be declared in the program using TABLES.
Der Return Code SY-SUBRC is undefined.
Delete an internal table MESSAGES, then fill the table with all messages from the table T100 with language key 'D' and ID 'RF'.
DATA MESSAGES TYPE TABLE OF T100 WITH HEADER LINE
MESSAGES-TEXT = 'Delete me'.
T100-SPRSL = 'E'.
T100-ARBGB = 'RF'.
REFRESH MESSAGES FROM TABLE T100.
REFRESH itab FROM SELECT-OPTIONS.
This variant is no longer supported (see also obsolete key words). The equivalent functionality is now available in the function module RS_REFRESH_FROM_SELECTOPTIONS.
Deletes the internal table itab and then transfers the database selections and the selection parameters together with the values entered by the user.
Cause: No more memory available to create the table
Runtime Error: REFRESH_NO_SHORT_MEMORY
plz reward if useful