The EXPORT ... TO MEMORY statement copies any number of ABAP data objects with their current values (data cluster) to ABAP memory. The ID addition, which can be a maximum of 60 characters long, enables you to identify different clusters.
In the cluster, the content of a given ABAP data object is labeled with a symbolic name. You specify this symbolic name in the EXPORT ... TO MEMORY statement on the left hand side of operator “=”.
When you use a new EXPORT TO MEMORY statement for an existing data cluster, the new statement overwrites the old one. The IMPORT ... FROM MEMORY ... statement allows you to copy data from ABAP memory to the corresponding fields of your ABAP program. You can also restrict the selection to a part of the data cluster in the IMPORT statement. The variables into which you want to read data from the cluster in ABAP memory must have the same types, in both the exporting and the importing programs.
Access to SAP Memory
You can define memory areas (called parameters) in SAP memory in the following ways:
Dynamic Data Objects
Strings and internal tables are dynamic data objects with memory requirements that can change during the program runtime. The system manages the working data of these data objects internally, using references.
Memory management treats deep data objects and flat data objects differently.
Memory Management for Flat Data Objects
Flat data objects are elementary data objects with fixed lengths and structures that only have flat components. The content of flat data objects represents actual working data. The system reserves memory for flat data objects as soon as it loads the program into the internal session. The system does not release the memory reserved for flat objects until it deletes the internal session.
Memory Management for Strings
When the system loads a program, it creates only a reference for the statically declared deep data objects at first, such as strings and internal tables. The static memory requirement for this reference is 8 bytes.
When you use the deep data object, additional working memory is requested at program runtime. For dynamic data objects (strings and internal tables), this memory is for the administration information (header) and the data object itself.
The memory requirement for a header depends on the hardware platform, but is around 100 bytes.
When the requested (allocated) memory is not sufficient for later access, additional memory can be reserved.