Register Login

Explain the EXPORT and IMPORT commands

Updated Feb 15, 2024

EXPORT Statement:

To transfer data objects from an ABAP program to ABAP memory, utilize the subsequent statement:

EXPORT <f1> [FROM <g1>] <f2> [FROM <g2>] ... TO MEMORY ID <key>.

This operation saves the specified data objects as a cluster in memory. If FROM <fi> the option is omitted, <fi> is preserved under its original name. When using FROM <gi> the option, <gi> is stored under the alias <fi>. The <key> denotes the memory cluster and can be up to 32 characters long.

The EXPORT statement consistently replaces any existing data cluster with an identical <key>.

IMPORT Statement:

To retrieve data objects from ABAP memory into an ABAP program, apply the ensuing statement:

IMPORT <f1> [TO <g1>] <f2> [TO <g2>] ... FROM MEMORY ID <key>.

This directive retrieves the listed data objects from a memory cluster. Without TO <gi> option, <fi> in memory is mapped to the corresponding data object in the program. Using the option, <fi> is loaded from memory into <gi>. The <key> identifies the memory cluster and can be up to 32 characters long.

Reading all objects under a specific <key> is not obligatory. You can specify the objects to retrieve by name. If no objects exist under <key>, SY-SUBRC is set to 4. If a cluster with <key> exists, SY-SUBRC is 0, regardless of whether it contains <fi>. If <fi> isn't in the cluster, the target field remains unaltered.