Application Development and Automation 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: 
Read only

Problem IMPORT/EXPORT TO MEMORY

Former Member
0 Likes
4,238

Hi All.

I have a problem with IMPORT/EXPORT TO MEMORY.

This is a simple code :

DATA : id1 TYPE c LENGTH 10 VALUE 'TEXTS'.

task = 1.

EXPORT task TO MEMORY ID id1.

DATA : task1(2) TYPE c.

IMPORT task1 FROM MEMORY ID id1.

WRITE : task1.

I expected that result is 1 but the field task1 is empty. Why?

1 ACCEPTED SOLUTION
Read only

ThomasZloch
Active Contributor
0 Likes
2,108

You are using the obsolete short form of IMPORT/EXPORT, there the two data object names "task" and "task1" must be identical.

You should rather use the slighty longer form with separate parameters and data objects. See F1 help for IMPORT and EXPORT statements, it is all explained.

Thomas

10 REPLIES 10
Read only

ThomasZloch
Active Contributor
0 Likes
2,109

You are using the obsolete short form of IMPORT/EXPORT, there the two data object names "task" and "task1" must be identical.

You should rather use the slighty longer form with separate parameters and data objects. See F1 help for IMPORT and EXPORT statements, it is all explained.

Thomas

Read only

0 Likes
2,108

The data object are the same.

Now, if I use this sintax

export task to memory id 'task'.

IMPORT task TO task1 FROM MEMORY ID 'task'.

this work well in same program but if I try to insert "IMPORT task TO task1 FROM MEMORY ID 'task'." in other program called by SUBMIT this don't work. ( This program is called in FM JOB_SUBMIT )

Do you have some example?

Read only

0 Likes
2,108

Hi,

I think in this case you need to use SET/GET,

Import/Export are considered only for 1 session,

in your case you are calling the program from some other,

so session is different.

Thanks,

Anmol Bhat

Read only

Former Member
0 Likes
2,108
this work well in same program but if I try to insert "IMPORT task TO task1 FROM MEMORY ID 'task'." in other program called by SUBMIT this don't work. ( This program is called in FM JOB_SUBMIT )

The reason may be that SAP uses different memory area for online and background activity.....also the data is not transferred..

When you are using IMPORT / EXPORT both the program needs to be in a single / similar call (session is correct word for online)

Read only

Former Member
0 Likes
2,108

Hello all.

Very late...

Solution would be shared memory.

Check EXPORT instruction help.

Read only

Former Member
0 Likes
2,108

Hi,

Export LIFNR TO MEMORY ID 'AB'. (ID is the name of memory, you don't need to create it ).

Import LIFNR FROM MEMORY ID 'AB'. (In Importing program create the same field name)

Read only

Former Member
0 Likes
2,108

HI All,

I too have the same problem.

Any body, have dealt with this issue ?

Thanking You All.

Read only

Former Member
0 Likes
2,108

HI,

I just changed your program the following way it worked within same program.

        DATA : id1    TYPE c LENGTH 10 VALUE 'TEXTS'.
        DATA : task1(2) TYPE c,
              task(2) TYPE c.
        task = 1.
        EXPORT P1 = task TO MEMORY ID id1.
        IMPORT P1 = task1       FROM MEMORY ID id1.
        WRITE : task1.

Also The same also worked when I Used SUBMIT and Return.

Regards,

Vasanth

Read only

vamsilakshman_pendurti
Active Participant
0 Likes
2,108

Hi,

Import and Export  Parameters are used only for data placed in the same session, other wise it is not useful..

i.e, ABAP memory( Local Memory ).

Better to go for SAP Memory like SET and GET will use for your scenario ...

Thanks ,

Vamsi.

Read only

Former Member
0 Likes
2,108

Hi all,

i think using the memory / shared memory is kinda risky, because every application server got its own memory. if you have more than 1 application server you never know on which of them your programm is executed to provide data to the memory and on which you want to recieve the data again. though it can happen that your memory stays empty after importing.

my personal opinion is better to use tables to store data.

regards

Stefan Seeburger