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

FREE MEMOMRY

Former Member
0 Likes
441

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?

2 REPLIES 2
Read only

Former Member
0 Likes
414

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

Read only

Former Member
0 Likes
414

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..