‎2008 Aug 04 12:43 PM
Hi....
In which situation , we hav go for FREE syntax..?
Where this statement mandatory to use...?
What this statemnet exatly do..?
> free itab.
( Expecting practical answer, no links or documentaion )
Thanks,
Naveen.I
‎2008 Aug 04 1:04 PM
Hi,
free itab.
means it will free the memory space created for the variable.
‎2008 Aug 04 12:45 PM
Hi
Free is used to delete the enitire internal table with its data and it memory is given back to SAP or OS.
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.
DATA: BEGIN OF LINE,
COL1,
COL2,
END OF LINE.
DATA ITAB LIKE TABLE OF LINE.
LINE-COL1 = 'A'. LINE-COL2 = 'B'.
APPEND LINE TO ITAB.
REFRESH ITAB.
IF ITAB IS INITIAL.
WRITE 'ITAB is empty'.
FREE ITAB.
ENDIF.
Regards
Pavan
‎2008 Aug 04 12:46 PM
free itab.
will release the memory which is allocated to itab.
‎2008 Aug 04 12:50 PM
Hi....Vijay...
So if i write
> free itab
before the select statement, My select statement should not work... isn't it?
Thanks,
Naveen Inuganti
‎2008 Aug 04 12:50 PM
<content removed by moderator as it was just a copy and paste without giving a source>
With luck,
Pritam.
Edited by: Mike Pokraka on Aug 4, 2008 2:43 PM
‎2008 Aug 04 12:50 PM
Hi,
with FREE statement we free the memory allocated by an internal table
‎2008 Aug 04 12:51 PM
hiii
it will relese memory occupied by that internal table..and will make it available for another use.
select statement will not work in this case..because you need to define internal table with that structure before using select query and after using FREE statement.
regards
twinkal
‎2008 Aug 04 1:01 PM
Hi.. Twinkal....
But Iam getting output list for this code...
>data: itab like ztable occurs 0 with header line.
>
>free itab.
>
>select * from ztable into corresponding FIELDS OF TABLE itab.
>
>loop at itab.
> write:/ itab-zfield.
>endloop.
Please let me know what is the purpose of free itab.. and if it will deallocates memory of itab.. why my above code giving output...
Also... where this FREE itab statement is mandatory.....
Hi Amit...
It is some what confusing for me every time.... Thats why i posted this question....i tried with F1....
i.e...,
> The FREE statement has the same effect as the CLEAR
> ....
> FREE has the same effect as the REFRESH statement....
Sorry to say this its confusing for me.. Amit...
And thank you very much for your attention...
Plz clear my doubt....
Thanks,
Naveen Inuagti
‎2008 Aug 04 12:59 PM
Press F1 on Key word and use SAP help.dont forget we are paying high buks them.
may be sometime we mis concept but SAP never
‎2008 Aug 04 1:04 PM
Hi,
free itab.
means it will free the memory space created for the variable.
‎2008 Aug 04 1:06 PM
Hi,
FREE statement is very usefull when you want to de allocate the momory that has been used by variable or Internal tables.
Raghav
‎2008 Aug 04 1:10 PM
Hi Ragavedhar and Manjari...
Thanks for ur attention...
Plz check my second reply for this thread...
Thanks,
Naveen Inuganti.
‎2008 Aug 04 1:16 PM
Hi
data: itab like table occurs 0 with header line.
free itab.
*select * from ztable into corresponding FIELDS OF TABLE itab.*
loop at itab.
write:/ itab-zfield.
endloop.
What is confusing you see Internal table is Dynamic I mean
check this statement
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.
that means when in the select query as soon as you are trying to fill the itab then dynamically again the memory is assigned to it
The FREE statement has the same effect as the CLEAR
....
FREE has the same effect as the REFRESH statement....
this means that apart from INITIALIZING the internal table to its default values it will even de-allocates the memory.
And more over REFRESH is applied to only to teh body of teh internal table not to the header line.
Regards
Pavan
‎2008 Aug 04 1:32 PM
Hi.... Pavan....
So If i Write free itab statement it will deallocates memory in application server...
again that memory will allocate dynamically with the select statement...
So...
Better to use Free itab syntax.. at the end of the all reports (after displaying iatb with write statement or somthing) to reduce the allocated memory area for internal tables in the application server...
Is n't it?
Thanks,
Naveen Inuganti.
‎2008 Aug 04 1:34 PM
table t with header line:
clear t deletes the header line
refresh t deletes the table content (initial value remains)
clear t[] deletes the table content (modern version of refresh)
free t deletes both (initial value remains)
table t without header line:
clear t[] deletes the table content (initial value remains)
refresh t same result as before
free t same result as before
free releases some more ressources, which I don't know exactly.
‎2008 Aug 04 1:37 PM
HI
To make you correct it is not application server it is ABAP memory as soon you write FREE and more over see to be more precise FREE is used if at all you come across a situation where you have to read the data from a table based on two different conditions so first time you will read teh data and then you FREE the memory for Performance issues and again you read the data into internal table based on the second condition.
Regards
pavan
‎2008 Aug 04 1:52 PM