SAP memory is a memory area that can be accessed by all sessions in the SAP GUI.
The big difference is that the ABAP memory can be accessed only in the same session.
Also, since it is not possible to directly store the internal table like ABAP memory, it can be used when you want to store only a specific value.
To use it, simply save the value with the SET PARAMETER command and call the value with the GET PARAMETER command.
Let’s create two reports and see if we can exchange values.
DATA TEXT1(30) TYPE C VALUE 'SET AND GET PARAMETER'.
SET PARAMETER ID 'MEM' FIELD TEXT1.
DATA TEXT2(30) TYPE C .
GET PARAMETER ID 'MEM' FIELD TEXT2.
WRITE : / TEXT2.
WRITE : 'GET PARAMETER'.
It is important to note that this command frees memory when the session expires (eg when you exit the GUI).
If you want to retain the value even when the session expires, create a parameter ID for the table: TPARA with transaction code: SM30 etc.
And instead of SET PARAMETER ID, it is possible to retain the value for the user ID by using G_SET_USER_PARAMETER, a general-purpose module, to store the value in memory.
However, be careful when using this method, as the maximum value that can be stored is limited to 40 digits.