Skip to Content
author's profile photo Former Member
Former Member

clear & refresh statements

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

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

5 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Jul 02, 2007 at 05:54 AM

    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.

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jul 02, 2007 at 05:50 AM

    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

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jul 02, 2007 at 05:56 AM

    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

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jul 02, 2007 at 06:03 AM

    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.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jul 02, 2007 at 06:12 AM

    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

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.