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 statement

Former Member
0 Likes
3,095

Hi experts,

What is exact meaning of refresh statement

Thanks & regards,

vijay.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
2,159

<b>REFRESH itab.</b>

<b>Effect</b>

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.

<b>Note</b>

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, <b>REFRESH itab</b> acts like <b>CLEAR itab</b>. Therefore, you should always use CLEAR instead of REFRESH.

reward points if it is usefull ...

Girish

12 REPLIES 12
Read only

sreeramkumar_madisetty
Active Contributor
0 Likes
2,159

Hello

Refresh : It will deletes the contents and memory also.

Regards,

Sree

Read only

Former Member
0 Likes
2,159

Hi ,

suppose itab is your internal table..

clear itab . " clear header.

clear itab[] . " clear only body but header line contains the data.

refresh itab. " clear only body but header line contains the data.

so in clear itab[] or refresh itab the bodyb will be deleted you can not access the data by loop at itab or by read table satatement after using clear itab[] and refresh.

in some cases you have to clear the header line because when you are refering the itab-f1 in loop at itab or in read table statement actually you are refering the header line data. So if you want to clear the header line in these occassion then you have to use clear itab.

Reward points if it helps..

Regards,

Omkar.

Message was edited by:

Omkaram Yanamala

Read only

Former Member
0 Likes
2,159

Hi,

REFRESH <itab>.

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

Reward if useful!

Read only

Former Member
0 Likes
2,159

REFRESH statement will clear the whole body of the internal table

Read only

Former Member
0 Likes
2,159

It is like the clear statement..mostly used with tables to refresh the table contents.

Regards,

Atish

Read only

Former Member
0 Likes
2,159

Hi

REFRESH ITAB

means deletes the complete Body data of internal table

Reward points for useful Answers

Regards

Anji

Read only

Former Member
0 Likes
2,160

<b>REFRESH itab.</b>

<b>Effect</b>

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.

<b>Note</b>

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, <b>REFRESH itab</b> acts like <b>CLEAR itab</b>. Therefore, you should always use CLEAR instead of REFRESH.

reward points if it is usefull ...

Girish

Read only

varma_narayana
Active Contributor
0 Likes
2,159

Hi..

REFRESH IT_TAB.

this statement deletes all the records of the internal table.

that means it will initialize the internal table.

But it will not deallocate the memory of internal table.

You can use

FREE IT_TAB.

This will deallocate the memory of internal table.

reward if helpful.

Read only

Former Member
0 Likes
2,159

hi,

<b>REFRESH <itab>.</b>: this statement will remove contents of internal table.

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.

regards,

Ashok Reddy

Read only

Former Member
0 Likes
2,159

it deletes all the memory info.

REFRESH

Initializes an internal table.

Syntax

REFRESH <itab>.

Resets the internal table <itab> to its initial value, that is, deletes all of its lines.

REFRESH CONTROL

Initializes a control.

Syntax

REFRESH CONTROL <ctrl> FROM SCREEN <scr>.

The control <ctrl> defined in the CONTROLS statement is reset with the initial values specified for screen <scr>.

Read only

Former Member
0 Likes
2,159

Clear ITAB[] : clear contents of the ITAB not header line.

clear ITAB : Clear header line, if itab is w/o header line, shows compilation error.

Refresh : same effect as refresh

Free ITAB : Clear ITAB and header line and free the memory as well.

Read only

Former Member
0 Likes
2,159

Hi,

To ensure that the table itself has been initialized, you can use the

REFRESH <itab>.

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.

DATA: BEGIN OF LINE,

COL1,

COL2,

END OF LINE.

DATA ITAB LIKE TABLE OF LINE.

LINE-COL1 = 'A'. LINE-COL2 = 'B'.

APPEND LINE TO ITAB.

REFRESH ITAB.

IF ITAB IS INITIAL.

WRITE 'ITAB is empty'.

FREE ITAB.

ENDIF.

The output is:

ITAB is empty.

In this program, an internal table ITAB is filled and then initialized with REFRESH. The IF statement uses the expression ITAB IS INITIAL to find out whether ITAB is empty. If so, the memory is released.

Please reward points.

Regards,

Ameet