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

Issue in Import/ Export Statement while using in VA02 transaction userexit

Former Member
0 Likes
1,097

Hi Gurus,

I am facing a peculiar problem while using IMPORT/EXPORT statement in VA02. In one userexit i am exporting a flag to memory id while in other userexit of the same program i am importing it. Sometimes it works and sometimes it doesnt.

In first user exit -

EXPORT lv_flag TO MEMORY ID sy-uname.

In Second User Exit -

IMPORT lv_flag FROM MEMORY ID sy-uname.

I am not sure what can be the possible reason for such kind of behavior.

Please suggest a proper solution/reason for the above issue.

Thanks and Regards,

Chirag

Hi Gurus,

I am facing a peculiar problem while using IMPORT/EXPORT statement in VA02. In one userexit i am exporting a flag to memory id while in other userexit of the same program i am importing it. Sometimes it works and sometimes it doesnt.

In first user exit -

EXPORT lv_flag TO MEMORY ID sy-uname.

In Second User Exit -

IMPORT lv_flag FROM MEMORY ID sy-uname.

I am not sure what can be the possible reason for such kind of behavior.

Please suggest a proper solution/reason for the above issue.

Thanks and Regards,

Chirag

4 REPLIES 4
Read only

vijay_hariharan
Contributor
0 Likes
901

Hi Chirag,

There might be a possibility that the relevant condition before the Export statement was not satisfied so there was nothing exported hence no value imported.

Using Export/Import can lead to issues while looking to trace the spots from where the value was Exported and where it was Imported unless explicitly mentioned in the Comments of the code. What we follow as practice is create a Function Group with two Function modules, one for Set(Mimicks Export) and the other for Get(Import). The value can be set in a Global variable declared for the Function group, hence will hold the value while you do a Get of the same variable:

eg:

Function Set_Variable

GV_VAR = IV_FLAG.

Endfunction.

Function Get_Variable

EV_FLAG = GV_VAR.

Endfunction.

Hope this helps.

Thanks & Regards,

Vijay

Read only

former_member206479
Participant
0 Likes
901

Hi Chirag Modi,

can you use memory id with different name instead sy-uname, bcz it's a system variable some times it may leads in consistency. And after import just clear the memory id by using FREE MEMORY ID <ID NAME>. I hope it will help you and let us know if you need anything regarding this.

Regards

Venkat.

Read only

0 Likes
901

Agree with Chirag modi,  Instead of using sy-uname use any variable or different name,

Value of sy-uname some times may differ in case of batch job etc.

Hope that will work.

Read only

keyur_pawar
Active Participant
0 Likes
901

Hi,

Why don't you use different variable in stead of SY-UNAME.

Let's try with putting memory id in single quotes.

In First User Exit -

EXPORT lv_flag TO MEMORY ID  'FLAG' .

In Second User Exit -

IMPORT lv_flag FROM MEMORY ID  'FLAG' .

Regards,

Keyur Pawar.