Application Development 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: 

CLEAR, REFRESH, FREE

former_member204732
Participant
0 Kudos

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

harsha_jalakam
Active Contributor
0 Kudos

This message was moderated.

Former Member
0 Kudos

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

Former Member
0 Kudos

Hi Ken,

Yes you are right.

Below is another discussion that confirms your points:

Regards,

Ashvin

rosenberg_eitan
Active Contributor

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.

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