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, FREE

Former Member
0 Likes
6,738

Hi ABAP expert


Is the point below a good summary.


Variables -

CLEAR -> delete variable contents - no usage for internal table


Internal Tables -

REFRESH -> delete internal table contents - but do not release the memory spaced occupied previously by the internal table

FREE -> delete internal table contents - and release completely the memory spaced occupied.

Conclusion -

Do you confirm the points below :

1. It's better to use FREE than REFRESH as you want to delete the internal table contents.

2. CLEAR on internal table will only delete the header line contents.


Cheers

Hi ABAP expert


Is the point below a good summary.


Variables -

CLEAR -> delete variable contents - no usage for internal table


Internal Tables -

REFRESH -> delete internal table contents - but do not release the memory spaced occupied previously by the internal table

FREE -> delete internal table contents - and release completely the memory spaced occupied.

Conclusion -

Do you confirm the points below :

1. It's better to use FREE than REFRESH as you want to delete the internal table contents.

2. CLEAR on internal table will only delete the header line contents.


Cheers

5 REPLIES 5
Read only

harsha_jalakam
Active Contributor
0 Likes
3,750

This message was moderated.

Read only

Former Member
0 Likes
3,750

Hi

Yes your conclusion are right

But I suppose this conclusion is valid mostly in OO ABAP,

REFRESH is like FREE, but it doesn't release the memory used for the initial line, this concept doesn't exit in OO, so now REFRESH is considered an obsolete command.

Max

Read only

Former Member
0 Likes
3,750

Hi Ken,

Yes you are right.

Below is another discussion that confirms your points:

Regards,

Ashvin

Read only

rosenberg_eitan
Active Contributor
3,750

Hi,

Clear can also be used with internal table  .

http://help.sap.com/abapdocu_740/en/

I prefer not to use internal tables with header.

Regards.

Read only

3,750

You are right Ken.

When internal table (say ITAB) is declared with header line, Then

CLEAR ITAB. would remove data ONLY from the HEADER line.

CLEAR ITAB[]. would remove data from the table LINES.

Usually, CLEAR is used to remove data from variables and work areas.

REFRESH, FREE is used for internal tables. And you have rightly pointed out the difference.

Cheers Raju.

<removed by moderator>

Message was edited by: Manish Kumar