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: 

How to get a variable value of a ABAP program in User-Exit

former_member143179
Participant
0 Kudos

Dear Sir,

We need to declare a variable in a ABAP program .  During the execution of ABAP program , an USER-EXIT is being called .  We need to access this ABAP program variable value in the  called USER-EXIT .

I request members to kindly guide me  to address this problem please .

With Regards

B Mittal

1 ACCEPTED SOLUTION

Chintu6august
Contributor
0 Kudos

Hi,

you can use EXPORT and IMPORT statements. Export the variable to the memory then import it in your user exit.

In your main program:

EXPORT <VARIABLE>TO MEMORY ID 'ZABAPmemory'.

In USER-EXIT

declare variable1 of same data type

IMPORT <VARIABLE1> FROM MEMORY ID 'ZABAPmemory'.

thanks!!

2 REPLIES 2

Former Member
0 Kudos

Use Sy-CPROG to get the calling program name.

Chintu6august
Contributor
0 Kudos

Hi,

you can use EXPORT and IMPORT statements. Export the variable to the memory then import it in your user exit.

In your main program:

EXPORT <VARIABLE>TO MEMORY ID 'ZABAPmemory'.

In USER-EXIT

declare variable1 of same data type

IMPORT <VARIABLE1> FROM MEMORY ID 'ZABAPmemory'.

thanks!!