2008 Jan 31 4:32 AM
What r the purpose of ID and KEY clause of FREE MEMOMRY stmt?
What r the purpose of ID and KEY clause of FREE MEMOMRY stmt?
2008 Jan 31 4:38 AM
FREE MEMORY without the id option can be dangerous i.e. it can lead to deleting the entire ABAP memory so any EXPORT command that has taken place internally (in the kernel) when your program is running will be lost forever.
Check the Link Below: http://help.sap.com/saphelp_webas620/helpdata/en/87/56d00722c011d2954a0000e8353423/content.htm
REgards
2008 Jan 31 4:56 AM
hi,
FREE MEMORY [ID <key>].
If you omit the addition ID <key>, the system deletes the entire memory, that is, all of the data clusters previously stored in ABAP memory using EXPORT. If you use the addition ID <key>, this statement only deletes the data cluster with the name <key>.
Only use the FREE MEMORY statement with the ID addition, since deleting the entire memory can also delete the memory contents of system routines.
PROGRAM SAPMZTST.
DATA: TEXT(10) VALUE '0123456789',
IDEN(3) VALUE 'XYZ'.
EXPORT TEXT TO MEMORY ID IDEN.
TEXT = 'xxxxxxxxxx'.
IMPORT TEXT FROM MEMORY ID IDEN.
WRITE: / SY-SUBRC, TEXT.
FREE MEMORY.
TEXT = 'xxxxxxxxxx'.
IMPORT TEXT FROM MEMORY ID IDEN.
WRITE: / SY-SUBRC, TEXT.
This produces the following output:
0 0123456789
4 xxxxxxxxxx
The FREE MEMORY statement deletes the data cluster "XYZ". Consequently, SY-SUBRC is 4 after the following IMPORT statement, and the target field remains unchanged.
plz reward points if helpful..