In SAP, if a value needs to be used within the same program or across different programs during a session, the memory id
can be used.
The memory id
can be used in several scenarios as follows.
- Remembering the last entered values in a selection screen and using them to fill in the fields in subsequent selections during the same session enhances the user experience and speeds up the workflow.
- The
memory id
can also be used to transfer data between two different code segments. For example, if you want to call a function that does not have the appropriate parameter (it could be a standard function) and you are writing code inside it, you can save a value with the exportmemory id
at the calling place and later retrieve this value inside the function using the importmemory id
. This value can be objects such as variables, internal tables, or structures.
data : lv_string type string.
lv_string = 'This is words.'.
export lv_string to memory id 'WORDS'.
clear : lv_string.
import lv_string from memory id 'WORDS'.
write : lv_string.
"This is words.