Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

What are Export and Import commands

Former Member
0 Kudos

Hi Experts,

What are Export and Import commands.

Regards,

Senthil

1 ACCEPTED SOLUTION

Former Member
0 Kudos

<b>EXPORT :-</b>To read data objects from an ABAP program into ABAP memory, use the following statement:

Syntax

EXPORT <f1> [FROM <g 1>] <f 2> [FROM <g 2>] ... TO MEMORY ID <key>.

This statement stores the data objects specified in the list as a cluster in memory. If you do not use the option FROM <f i >, the data object <f i > is saved under its own name. If you use the FROM <g i > option, the data objet <g i > is saved under the name <f i >. The name <key> identifies the cluster in memory. It may be up to 32 characters long.

The EXPORT statement always completely overwrites the contents of any existing data cluster with the same name <key>.

<b>

IMPORT :-</b>To read data objects from ABAP memory into an ABAP program, use the following statement:

Syntax

IMPORT <f1> [TO <g 1>] <f 2> [TO <g 2>] ... FROM MEMORY ID <key>.

This statement reads the data objects specified in the list from a cluster in memory. If you do not use the TO <g i > option, the data object <f i > in memory is assigned to the data object in the program with the same name. If you do use the option, the data object <f i > is read from memory into the field <g i >. The name <key> identifies the cluster in memory. It may be up to 32 characters long.

You do not have to read all of the objects stored under a particular name <key>. You can restrict the number of objects by specifying their names. If the memory does not contain any objects under the name <key>, SY-SUBRC is set to 4. If, on the other hand, there is a data cluster in memory with the name <key>, SY-SUBRC is always 0, regardless of whether it contained the data object <f i >. If the cluster does not contain the data object <f i >, the target field remains unchanged.

7 REPLIES 7

Former Member
0 Kudos

<b>EXPORT :-</b>To read data objects from an ABAP program into ABAP memory, use the following statement:

Syntax

EXPORT <f1> [FROM <g 1>] <f 2> [FROM <g 2>] ... TO MEMORY ID <key>.

This statement stores the data objects specified in the list as a cluster in memory. If you do not use the option FROM <f i >, the data object <f i > is saved under its own name. If you use the FROM <g i > option, the data objet <g i > is saved under the name <f i >. The name <key> identifies the cluster in memory. It may be up to 32 characters long.

The EXPORT statement always completely overwrites the contents of any existing data cluster with the same name <key>.

<b>

IMPORT :-</b>To read data objects from ABAP memory into an ABAP program, use the following statement:

Syntax

IMPORT <f1> [TO <g 1>] <f 2> [TO <g 2>] ... FROM MEMORY ID <key>.

This statement reads the data objects specified in the list from a cluster in memory. If you do not use the TO <g i > option, the data object <f i > in memory is assigned to the data object in the program with the same name. If you do use the option, the data object <f i > is read from memory into the field <g i >. The name <key> identifies the cluster in memory. It may be up to 32 characters long.

You do not have to read all of the objects stored under a particular name <key>. You can restrict the number of objects by specifying their names. If the memory does not contain any objects under the name <key>, SY-SUBRC is set to 4. If, on the other hand, there is a data cluster in memory with the name <key>, SY-SUBRC is always 0, regardless of whether it contained the data object <f i >. If the cluster does not contain the data object <f i >, the target field remains unchanged.

Former Member
0 Kudos

Hi Senthil,

Check out this thread...

<b>IMPORT</b>: Imports data objects (fields or tables) from the ABAP/4 memory. Reads in all data without an ID that was exported to memory with "EXPORT ... TO MEMORY." . In contrast to the variant IMPORT FROM DATABASE , it does not check that the structure matches in EXPORT and IMPORT

<b>EXPORT</b>: Exports the objects obj1 ... objn (fields, structures or tables) as a data cluster to ABAP/4 memory . If you call a transaction, report or dialog module (with CALL TRANSACTION , SUBMIT or CALL DIALOG ), the contents of ABAP/4 memory are retained, even across several levels. The called transaction can then retrieve the data from there using IMPORT ... FROM MEMORY . Each new EXPORT ... TO MEMORY statement overwrites any old data, so no data is appended.If the processing leaves the deepest level of the call chain, the ABAP/4 memory is released.

dani_mn
Active Contributor
0 Kudos

HI,

they are used to save and reterive data in ABAP memory.

here is an example to clear about them.

<b>REPORT ZWA_TEST2 .

data: it_bkpf type table of bkpf with header line.

SELECT * FROM bkpf into table it_bkpf.


EXPORT it_bkpf TO MEMORY ID 'MID'.

refresh it_bkpf.

IMPORT it_bkpf FROM MEMORY ID 'MID'.

LOOP AT It_bkpf.
write:/ it_bkpf-belnr.
ENDLOOP.</b>

Regards,

HRA

Former Member
0 Kudos

Hi,

Is your question referring to exporting or importing contents to ABAP memory. Then above replies will answer ur question. Alternatively u can use F1 key to get help on any key word.

- Sanjay.

former_member181962
Active Contributor
0 Kudos

Export statement will temporarily store the expoted data object in abap memory.

Import will retrieve that data.

Basically these statements are used when you want to use an already filled data object's value in another program.

Regards,

ravi

Former Member
0 Kudos

Former Member
0 Kudos

hi,

In SAP when we want to use the value of some program into another program we use export and import statments. So, you can temporily store the data in abap memory using the export statment. And later on retrieve that same data using import statement.

You got lots of answers with syntax and other details.

Regards,

Richa