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: 

Export- Import to Memory Query

Former Member
0 Kudos

Hello Everyone,

I have 2 FMs where one exports variable to memory and other FM imports the same .

FM A:

DATA: id TYPE c LENGTH 10 VALUE 'SWITCH_WO',

id1 TYPE c LENGTH 10 VALUE 'SWITCH_OP'.

EXPORT g_workorder from g_workorder TO MEMORY ID id.

EXPORT g_operation from g_operation TO MEMORY ID id1.

FM B:

DATA: id TYPE c LENGTH 10 VALUE 'SWITCH_WO',

id1 TYPE c LENGTH 10 VALUE 'SWITCH_OP'.

IMPORT g_workorder FROM MEMORY ID id.

IMPORT g_operation FROM MEMORY ID id1.

When it export Sy-subrc is 0 but when i import it is 4 , where can i check memory variable in new debugger.

Please let me know ,

Regards,

Raj

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hello,

You can use the Import and export to Memory Id only with the programs and FM which runs in the same session, because that memory is only available in the same session of the memory. Once you have imported say a internal table/work area to some memory id and the session ends the memory is cleared by the Garbage Collector.

In your case you are using 2 FM each running in different session, Import and Export to memory id will not work for you (as said it works in a single session). Try to use concepts of Shared Memory Object or populate a table (Custom table) and try to retrieve the same from 2nd FM.

Hope it helps.

Thanks,

Jayant

7 REPLIES 7

Former Member
0 Kudos

Hello,

You can use the Import and export to Memory Id only with the programs and FM which runs in the same session, because that memory is only available in the same session of the memory. Once you have imported say a internal table/work area to some memory id and the session ends the memory is cleared by the Garbage Collector.

In your case you are using 2 FM each running in different session, Import and Export to memory id will not work for you (as said it works in a single session). Try to use concepts of Shared Memory Object or populate a table (Custom table) and try to retrieve the same from 2nd FM.

Hope it helps.

Thanks,

Jayant

0 Kudos

Hi

As correctly pointed out by Jayant, memory id will retain value in same session only i.e. u'll need to run ur FM's one after another in the SAME session. However, if this is not possible, use the concept of database memory,i.e export your values to Database memory and import them in whicj ever session you want.

Do an F1 on " export to indx(xy)... "

This'll help you,

Cheers

Ravish

0 Kudos

Hi Ravish,

Can u provide me with the syntax.. of Database memory or shared memory

Regards,

Raj

0 Kudos

Hi,

Set parameter id and Get parameter id

Or else you can try with RFCs.

Rhea.

0 Kudos

HI

Here is the sample syntax:

EXPORT tab FROM it_result2

TO DATABASE indx(xy)

CLIENT sy-mandt

ID 'ANYID'.

if you do an F1 for this you'll find the exact syntax for import and export.

Cheers

Ravish

Former Member
0 Kudos

Hi ,

check the sytax for IMPORT.

i should be like this

IMPORT IT_COMM_AREA TO IT_COMM_AREA1 FROM MEMORY ID I_ID.

regards

Prabhu

former_member1245113
Active Contributor
0 Kudos

Hi,

Are you using the FM in the same program? then you can use IMPORT EXPORT

if you are using in 2 different sessions, then use SET PARAMETER GET PARAMETER

This also depends on key words like

SUBMIT

SUBMIT AND RETURN

CALL TRANSACTION

LEAVE TO TRANSACTION

CALL FUNCTION STARTING A NEW TASK

please go through the KEY word documenations of the corresponding key words

Regards

Ramchander Rao.K