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

clear & refresh statements

Former Member
0 Likes
760

hi all,

could u pls give me a brief example about when do we exactly clear the header and refresh the body of an internal table .

thanks in advance

spoorthimanohar

5 REPLIES 5
Read only

gopi_narendra
Active Contributor
0 Likes
729

Clear : clear only the work area or header

Refresh : Clears the whole contents of the internal table

For example you have an internal table it_tab[] with 12 rows and 12 columns with header line

loop at it_tab.

here it_tab contains one record in the header.

clear it_tab --> Clears only the HEADER.

endloop.

refresh : it_tab. --> Clears all the 12 records and empties the internal table.

Regards

Gopi

Read only

Former Member
0 Likes
729

If u have one internal table

Clear will clear the headerline and Refresh will clear the whole internal table but Refresh will not clear the header line.If u didnt use Clear statement then the hederlinew iwll be there and it will have recent values.

Read only

Former Member
0 Likes
729

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.

regards

shiba dutta

Read only

Former Member
0 Likes
729

Hi,

Clear:

Deletes the content of the header area of internal table

Does not delete the content of the internal table

Refresh:

Deletes the content of the internal table

Does not delete the content of the header area

We clear the header while updating or appending data into internal table

let itab be the intenal table with header line.

itab-name = 'XXXX'.

itab-empno = 'XXXX'.

append itab.

clear itab. -> <b>clears the header line.</b>

<b>refresh itab can also be used.</b>

Refresh does not refresh the body of internal table . It refreshes only the header line.

clear[] - clears the body of the internal table.

Regards,

Priyanka.

Read only

Former Member
0 Likes
729

hi,

clear is used to clear the body of an internal table, to clear the work area or header of an internal table.

data: itab like mara occurs 0 with header line,

data: int type i value 13.

ex: clear itab. // clears the header line of internal table itab.

clear itab []. // clears the entire content in internal table which includes header and body of an internal table.

clear int. // clears the value of integer varaible to null.

refresh: used to clear the heder line of an internal table or even an explicit work area.

ex: refresh itab. // erases the contents of an workarea or internal table header.

if helpful reward some points.

with regards,

Suresh.A