Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

refresh clear.

Former Member
0 Likes
608

hi mates,

what is the difference bt refresh and clear. whats their usage in internal table. can anyone give sample code on usage of refresh , clear on internal tables.

regards

Manoharan

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
592

hi,

Use CLEAR to reset any variable data object to the initial value appropriate to its type.

In a structure, each component is reset individually.

In an internal table w ithout a header line, all of the lines are deleted.

FREE <itab>.

Unlike CLEAR, which only deletes the contents of the table, FREE releases the memory occupied by it

as well.

CLEAR Sets the contents of the internal table to the right initial value for the column type.

REFRESH works like CLEAR.

Hope this helps, Do reward.

4 REPLIES 4
Read only

Former Member
0 Likes
592

Hi

Clear will cleras the header information where as Refresh will also do same but it will remove all the BODY data available in internal table

CLEAR

Structures are set to their initial values component by component

means only header information

REFRESH

This statement sets an internal table itab to its initial value, meaning that it deletes all rows of the internal table. The memory space required for the table is freed up to the initial memory size INITIAL SIZE. For itab, you must specify an internal table.

To delete all rows and free the entire memory space occupied by rows, you can use the statement FREE.

The statement REFRESH itab acts for all internal tables like CLEAR itab[]. If an internal table itab has a header line, then the table body and not the header line is initialized. If the internal table itab has no header line, REFRESH itab acts like CLEAR itab. Therefore, you should always use CLEAR instead of REFRESH.

Read only

Former Member
0 Likes
593

hi,

Use CLEAR to reset any variable data object to the initial value appropriate to its type.

In a structure, each component is reset individually.

In an internal table w ithout a header line, all of the lines are deleted.

FREE <itab>.

Unlike CLEAR, which only deletes the contents of the table, FREE releases the memory occupied by it

as well.

CLEAR Sets the contents of the internal table to the right initial value for the column type.

REFRESH works like CLEAR.

Hope this helps, Do reward.

Read only

Former Member
Read only

Former Member
0 Likes
592

Hello Manoj,

It depends how you have defined your internal table:

a) Using the OCCURS clause (this shouldn't be done anymore!):

CLEAR initializes the Header line

REFRESH initializes the entire internal table

b) Using the TYPE TABLE (STANDARD | SORT | HASH)

CLEAR initializes the entire internal table! This is very important when you change the definition of your itab.

REFRESH does the same as it does in a). It initializes the entire itab.

I hope this is quite clear (not REFRESH; ha ha)

Heinz