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: 

Global Variable (?)

balaji_viswanath
Participant
0 Kudos

I have written code in user-exit for MB31.

EXIT_SAPLIPW1_001 and EXIT_SAPLIPW1_008.

EXIT_SAPLIPW1_001 is getting fired first when user clicks "Create Serial Number automatically" button. If this is code is executed I don't want to execute EXIT_SAPLIPW1_008. So now I want to keep some global flag variable (?) and check the status. If the status is updated then I will not execute the code in EXIT_SAPLIPW1_008. If the status is not updated i.e. user has not clicked "Create Serial Number automatically" button then I want to execute EXIT_SAPLIPW1_008.

How to do it?

Advance thanks.

Regards,

Balaji Viswanath.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi Balaji.

From the first screen of the exit EXIT_SAPLIPW1_001 goto global data and choose include ZXQSMTOP which will be created the first time you click. Any data defined in this include will be global data, so define a switch here which will be set in EXIT_SAPLIPW1_001. You can then check in exit EXIT_SAPLIPW1_008 if the switch has been set.

Regards,

John.

8 REPLIES 8

Former Member
0 Kudos

Hi Balaji.

From the first screen of the exit EXIT_SAPLIPW1_001 goto global data and choose include ZXQSMTOP which will be created the first time you click. Any data defined in this include will be global data, so define a switch here which will be set in EXIT_SAPLIPW1_001. You can then check in exit EXIT_SAPLIPW1_008 if the switch has been set.

Regards,

John.

0 Kudos

Hi,

I created include ZXQSMTOP and having a variable (l_flag) there.

In EXIT_SAPLIPW1_001 I am updating the variable (i.e. l_flag = 'T')

In EXIT_SAPLIPW1_008 also I include ZXQSMTOP and checking for the l_flag value... but in l_flag there is no value. But what I am expecting is 'T'.

How to do it?

Regards,

Balaji Viswanath.

0 Kudos

When you clicked the button 'Create Serial Numbers Automatically', check the value for l_flag.

a) Does it change to 'T' ?

b) Are there any places where you are clearing this value ?

User-Exits can be a little troublesome at times, and in most cases, frustrating.

Debugging patiently will yield good results.

Regards,

Subramanian V.

0 Kudos

Yes, initially it's getting changed to 'T' but immeditely another exit is getting fired but that time value is ' '.

i.e. variable is getting initlized. Nowhere else I am changing the value. Why variable is getting initlized?

Or any work-around is there to solve this problem?

Regards,

Balaji Viswanath.

0 Kudos

Two things you need to check:

a) How many places have you declared that variable ?

b) Have you declared this in Z*TOP , as mentioned by John.

If you have declared it in the TOP and if you have only a single global variable, then there would be no reason for it to change(at least no obvious reasons).

Regards,

Subramanian V.

0 Kudos

I have declared that variable in only one place i.e. in ZXQSMTOP.

I am including ZXQSMTOP in both user-exits.

first in EXIT_SAPLIPW1_001 I have updating the value of l_flag to 'T' but in EXIT_SAPLIPW1_008 it's becoming ' '.

Regards,

Balaji Viswanath.

0 Kudos

Hi Balaji,

You should NOT include the ZXQSMTOP in your user exit! It is already included in the function pool to which both user exits belong. Just declare your variable in the include and then set the variable in the first user exit and check it in the second one!

Regards,

John.

0 Kudos

Thanks a lot John, it's working now.

Regards,

Balaji. V