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 and Clear?

Former Member
0 Likes
689

HI,

What is the exact ddiff between these two?

Regards,

Laxmi.

HI,

What is the exact ddiff between these two?

Regards,

Laxmi.

6 REPLIES 6
Read only

Former Member
0 Likes
647

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

Read only

Former Member
0 Likes
647

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.

Read only

0 Likes
647

Refresh clears or empties the whole internal table

refresh : itab.

Clear : clears only the work area or header line

clear : itab.

Regards

- Gopi

Read only

Former Member
0 Likes
647

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

Read only

Former Member
0 Likes
647

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

Read only

Former Member
0 Likes
647

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