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

hi

Former Member
0 Likes
899

Hi Guru,

can u plz any of u give me the detailed info about CLEAR, REFRESH, FREE

Thanks,

Kalyani...

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
874

hi..

<b>CLEAR <itab>.</b>

statement. This statement restores an internal table to the state it was in immediately after you declared it. This means that the table contains no lines. However, the memory already occupied by the memory up until you cleared it remains allocated to the table.

If you are using internal tables with header lines, remember that the header line and the body of the table have the same name. If you want to address the body of the table in a comparison, you must place two brackets ([ ]) after the table name.

<b>CLEAR <itab>[].</b>

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

<b>REFRESH <itab>.</b>

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

refresh should use only internal table,clear - you can use variables,internal table ,work areas

<b>FREE :</b> it is deallocating meomry

You can use FREE to initialize an internal table and release its memory space without first using the REFRESH or CLEAR statement. Like REFRESH, FREE works on the table body, not on the table work area. After a FREE statement, you can address the internal table again. It still occupies the amount of memory required for its header (currently 256 bytes). When you refill the table, the system has to allocate new memory space to the lines.

<b>Reward points if useful</b>

Regards

Ashu

10 REPLIES 10
Read only

Former Member
0 Likes
875

hi..

<b>CLEAR <itab>.</b>

statement. This statement restores an internal table to the state it was in immediately after you declared it. This means that the table contains no lines. However, the memory already occupied by the memory up until you cleared it remains allocated to the table.

If you are using internal tables with header lines, remember that the header line and the body of the table have the same name. If you want to address the body of the table in a comparison, you must place two brackets ([ ]) after the table name.

<b>CLEAR <itab>[].</b>

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

<b>REFRESH <itab>.</b>

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

refresh should use only internal table,clear - you can use variables,internal table ,work areas

<b>FREE :</b> it is deallocating meomry

You can use FREE to initialize an internal table and release its memory space without first using the REFRESH or CLEAR statement. Like REFRESH, FREE works on the table body, not on the table work area. After a FREE statement, you can address the internal table again. It still occupies the amount of memory required for its header (currently 256 bytes). When you refill the table, the system has to allocate new memory space to the lines.

<b>Reward points if useful</b>

Regards

Ashu

Read only

Former Member
0 Likes
874

clear will intialize the contents of the variable.

refresh, is used for internal tables. REFRESH ITAB = CLEAR ITAB[].

FREE , apart from clearing the contents, will also deallocate the memory allocated to the itab.

Regards,

Ravi

Read only

Former Member
0 Likes
874

hI,

CLEAR <itab>.

Statement. This statement restores an internal table to the state it was in immediately after you declared it. This means that the table contains no lines. However, the memory already occupied by the memory up until you cleared it remains allocated to the table.

If you are using internal tables with header lines, remember that the header line and the body of the table have the same name. If you want to address the body of the table in a comparison, you must place two brackets ([ ]) after the table name.

CLEAR <itab>[].

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. To release the memory space, use the statement

FREE <itab>.

You can use FREE to initialize an internal table and release its memory space without first using the REFRESH or CLEAR statement. Like REFRESH, FREE works on the table body, not on the table work area. After a FREE statement, you can address the internal table again. It still occupies the amount of memory required for its header (currently 256 bytes). When you refill the table, the system has to allocate new memory space to the lines.

<b>Reward points</b>

Regards

Read only

Former Member
0 Likes
874

CLEAR <itab>.

Statement. This statement restores an internal table to the state it was in immediately after you declared it. This means that the table contains no lines. However, the memory already occupied by the memory up until you cleared it remains allocated to the table.

If you are using internal tables with header lines, remember that the header line and the body of the table have the same name. If you want to address the body of the table in a comparison, you must place two brackets ([ ]) after the table name.

CLEAR <itab>[].

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. To release the memory space, use the statement

FREE <itab>.

You can use FREE to initialize an internal table and release its memory space without first using the REFRESH or CLEAR statement. Like REFRESH, FREE works on the table body, not on the table work area. After a FREE statement, you can address the internal table again. It still occupies the amount of memory required for its header (currently 256 bytes). When you refill the table, the system has to allocate new memory space to the lines.

<b>rewards point for useful answer......</b>

regards...

Abhay Singh.

<b></b>

Read only

Former Member
0 Likes
874

<b>CLEAR</b>

Basic form

CLEAR f.

Extras:

1.... WITH g

2.... WITH g IN CHARACTER MODE

3.... WITH g IN BYTE MODE

2.... WITH NULL

Effect

Resets the contents of f to its initial value.

For predefined types (see DATA), the following initial values are used:

Type C:

' ... ' (blank character)

Type N:

'00...0'

Type 😧

'00000000'

Type T:

'000000'

Type I:

0

Type P:

0

Type F:

0.0E+00

Type X:

0

Typ STRING:

`` (empty string)

Typ XSTRING:

`` (empty byte sequence)

If f is a field string, each component field is reset to its initial value. If it is an internal table without a header line, the entire table is deleted together with all its entries. If, however, f is an internal table with a header line, only the subfields in the table header entry are reset to their initial values.

Example

DATA: TEXT(10) VALUE 'Hello',

NUMBER TYPE I VALUE 12345,

ROW(10) TYPE N VALUE '1234567890',

BEGIN OF PLAYER,

NAME(10) VALUE 'John',

TEL(8) TYPE N VALUE '08154711',

MONEY TYPE P VALUE 30000,

END OF PLAYER.

...

CLEAR: TEXT, NUMBER, PLAYER.

The field contents are now as follows:

ROW = '1234567890'

TEXT = ' '

NUMBER = 0

PLAYER-NAME = ' '

PLAYER-TEL = '00000000'

PLAYER-MONEY = 0

Notes

When CLEAR itab references an internal table itab with a header line, it only resets the subfields in the header entry to their initial values (as mentioned above). The individual table entries remain unchanged.

To delete the entire internal table together with all its entries, you can use CLEAR itab[] or REFRESH itab.

Within a logical expression, you can use f IS INITIAL to check that the field f contains the initial value appropriate for its type.

Variables are normally initialized according to their type, even if the specification of an explicit initial value is missing (the "... VALUE lit" addition to the DATA statement). For this reason, it is not necessary to initialize variables again with CLEAR after defining them.

Addition 1

... WITH g

In some cases, the syntax rules that apply to Unicode programs are different than those for non-Unicode programs.In Unicode programs, CLEAR f WITH g is treated just like CLEA Processing Character Strings and String Processing for Byte Sequences.

Effect

The field f is filled with the value of the first byte of the field g. If f is a string, it is filled to the current length. If g is a string, it is must have length 1.

Addition 2

... WITH g IN CHARACTER MODE

The field f is filled with the character g. f must be a character-type single field or a string. If f is a string, it is filled to its current length. g must be a character-type single field with length 1 or a string with the current length 1.

Addition 3

... WITH g IN BYTE MODE

Effect

The field f is filled with the byte g. f must be a byte-type single field or an XSTRING-type field.

If f is an XSTRING-type field, it is filled to its current length. g must be a byte-type single field with length 1 or an XSTRING-type field with the current length 1.

Addition 4

... WITH NULL

This addition is not allowed in an ABAP Objects context.See Cannot Use CLEAR WITH NULL.

Effect

Fills the field with hexadecimal zeros.

Note

You should use this addition with particular care because the fields of most data types thus receive values that are really invalid.

<b>FREE - Resets a data object to its original value and releases the resources it occupied</b>.

Basic form

FREE f.

Effect

FREE f has the same effect as CLEAR f , namely that a Data object f is reset to the initial value corresponding to its type.

Unlike CLEAR, FREE also releases any resources taken up by the data object f. FREE can also release more resources than CLEAR for table work areas declared using the TABLES statement.

After FREE f, the data object f can be re-addressed at any time. The only condition is that you may need to re-allocate resources to the object.

Note

If f is an internal table with header line (where the name f in a sense has two meanings) the statement FREE f refers to the body of the table, and the statement CLEAR f refers to the header line.

Note

<b>REFRESH itab.</b>

Effect

The internal table itab is reset to its initial state, i.e. all table entries are deleted.

Der Return Code SY-SUBRC is undefined.

Notes

The header entry of a table with a header line remains unchanged. It can be reset to its initial value using CLEAR.

FREE itab can be used to free up the memory allocated to the table.

Read only

Former Member
0 Likes
874

Hi,

CLEAR : clear s heder line.body will bw as it is.

REFRESH : Delete records from body. memory will be still allocated.

FREE : Deletes records from body. memory is freed.

Reward points if helpful.

Regards.

Srikanta Gope

Read only

Former Member
0 Likes
874

Hi kalyani,

clear: it clears the work area data if it is a internal table with header

clear field -> it clears the field

refresh : it clears the internal table data

free:it removes the data from memory

regrads

suman

Read only

Former Member
0 Likes
874

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

Free:

Frees the memory space allocated to the internal table

Thanks

Read only

Former Member
0 Likes
874

Hi,

FREE--- deletes all row of internal table and releases the memory occupied by the body.Header line if exists remain unchanged.

REFRESH--same as FREE only difference is that the memory occupied by the body of internal table is not released.

CLEAR itab.

CLEAR itab[]

---if header line exists 1st one clears header line and later one deletes all rows of itab.

-- if without header line both clears the body of itab, but memory allocated is not freed.

pls reward if useful,

Regards,

Deb

Read only

Former Member
0 Likes
874

Hi,

<u><b>CLEAR:</b></u>

Like all data objects, you can initialize internal tables with the

CLEAR <itab>.

statement. This statement restores an internal table to the state it was in immediately after you declared it. This means that the table contains no lines. However, the memory already occupied by the memory up until you cleared it remains allocated to the table.

If you are using internal tables with header lines, remember that the header line and the body of the table have the same name. If you want to address the body of the table in a comparison, you must place two brackets ([ ]) after the table name.

CLEAR <itab>[].

<u><b>REFRESH:</b></u>

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.

<u><b>FREE:</b></u>

To release the memory space, use the statement

FREE <itab>.

You can use FREE to initialize an internal table and release its memory space without first using the REFRESH or CLEAR statement. Like REFRESH, FREE works on the table body, not on the table work area. After a FREE statement, you can address the internal table again. It still occupies the amount of memory required for its header (currently 256 bytes). When you refill the table, the system has to allocate new memory space to the lines.

Regards,

Bhaskar