2006 Oct 16 10:25 AM
HI,
What is the exact ddiff between these two?
Regards,
Laxmi.
2006 Oct 16 10:27 AM
Hi
clear statement clears the header while refresh clears the body of Internal table ...
<b>Check</b>
http://help.sap.com/saphelp_nw2004s/helpdata/en/fc/eb384e358411d1829f0000e829fbfe/content.htm
<b>Check this sample code:</b>
REPORT ypra_sample61.
TYPES: BEGIN OF ty_itab,
data1 TYPE char10,
data2 TYPE char10,
END OF ty_itab.
DATA: itab TYPE STANDARD TABLE OF ty_itab,
wa_itab TYPE ty_itab.
DATA: itab1 TYPE ty_itab OCCURS 0 WITH HEADER LINE,
wa_itab1 TYPE ty_itab.
wa_itab-data1 = '12'.
wa_itab-data2 = '112'.
APPEND wa_itab TO itab.
CLEAR: wa_itab, itab.
*Here the clear will clear both the header and as well as Body - Because
*it is declared as type standard table of ty_itab.
wa_itab1-data1 = '12'.
wa_itab1-data2 = '112'.
APPEND wa_itab1 TO itab1.
CLEAR: wa_itab1, itab1.
REFRESH: itab1.
<b>*Here both the clear & refresh should be given to clear the workarea & *the internal table</b>
Reward with points it is helpful
Cheers
Alfred
2006 Oct 16 10:27 AM
Hi kishi,
1. Refresh ITAB = clears the WHOLE internal table
ie. clears the whole body, all records
CLEAR ITAB = ONLY clears the header line.
regards,
amit m.
2006 Oct 16 10:29 AM
Refresh clears or empties the whole internal table
refresh : itab.
Clear : clears only the work area or header line
clear : itab.
Regards
- Gopi
2006 Oct 16 10:27 AM
Hi
<b>REFRESH</b> is used to clear the entire contents of an internal table
<b>CLEAR</b> is used to clear the header line or a work area or variables
2006 Oct 16 10:29 AM
Refresh is used with referance to an internal table.
It deletes the entries of the internal table.
The header of the internal table wil still be the same(Not cleared).
Clear would also do the same but can be used with referance to any data type. It sets the new value to the default value of the type of the variable being cleared.
Note that
clear itab[] = refresh itab.
Regards,
Ravi
Message was edited by: Ravi Kanth Talagana
2006 Oct 16 10:31 AM
HI Kishi
Will try to keep it simple for you.
Using CLEAR, we erase contents of variables or structures(including work areas).
Eg: clear: l_var.
clear: wa_itab.
REFRESH: is w.r.t internal table which clears the whole contents of internal table.
Eg: refresh itab.
Using clear we can even clear the contents of the internal table using statement.
Eg: clear: itab[].
Best example to explain the same is:
data: begin of itab occurs 0,
fld1,
fld2,
end of itab.
clear: itab. --> Clears the header or workarea
refresh: itab. --> Clears the contents of the internal table.
clear: itab[]. --> Clears the contents of the internal table.
Here itab[] identifies the contents of the internal table and itab identifies the work area.Hope this helps you.
Kind Regards
Eswar