IMPORT and EXPORT statements in ABAP programming are used for Reading and writing the data objects in the data cluster of ABAP memory of the current internal session. This statement can also use with cluster database tables and shared buffer of the tables. Here we are going to look at these statements with ABAP memory.
EXPORT statement for ABAP memory
EXPORT statement is used for writing the data objects in ABAP memory from our ABAP programs. It stores the data as a cluster in memory of the current internal session.
EXPORT <f1> [FROM <g 1>] <f 2> [FROM <g 2>] … TO MEMORY ID <key>.
- FROM addition is used for specifying the name to store the data objects in memory.If we have not specified, the data will store with the same name of the data object in ABAP program.
- If the specified memory id (<key>) already exists in memory, data will be over written.
IMPORT statement for ABAP memory
IMPORT statement is used for reading the data objects stored in ABAP memory from our ABAP program.
IMPORT <f1> [TO <g 1>] <f 2> [TO <g 2>] … FROM MEMORY ID <key>.
- TO addition is used for specifying the name of the data objects in ABAP program for storing the data from memory. If we are not specified , the same name in memory will be used for that.
- If the specified memory (<key>) does not contain any data objects, the system field sy-subrc will set as 4.(Otherwise it will be 0).
See the sample programs
Sample program for EXPORT
Sample program for IMPORT
Also Read : View Other ABAP Keywords & Syntax -> ABAP Transaction codes