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 declare Global variable in BADI

Former Member
0 Kudos

Hi All,

How to declare Global variable in BADI, in one of the thread they mentioned following.

Goto SE19 -> enter your BADI name.

goto the interface name.

Double click on " Name of implementing class: ".

go to the attributes tab. Here you can add the variable.

But this is not working.

Thanks,

Narayan

5 REPLIES 5

martin_voros
Active Contributor
0 Kudos

What is not working? The attribute will be accessible from all methods. If you define it as public then you will be able to access it from outside if you can get reference to badi.

Cheers

madhu_vadlamani
Active Contributor
0 Kudos

HI Narayan,

1) In that class check all the declaration will be there 2) DATA IT_LFA1 TYPE LFA1. INCLUDE mm_messages_mac. 3) Are you working with standard badi or custom one . Please elaborate .

Regards,

Madhu.

Former Member
0 Kudos

You can not do that globally as in SAP provided BADIs you have no permission to change the interface attributes and all.

you may handle the attribute as a variable inside the program.

Regards,

Prasenjit

0 Kudos

You can not do that globally as in SAP provided BADIs you have no permission to change the interface attributes and all.

No, it works just as the poster and Martin described. Perhaps you didn't read the question carefully enough. You certainly have permission because the implementing class is under your control...

Former Member
0 Kudos

Hi All,

All,

Thanks for the suggestions. We fixed by using Export and Import. Just a temporary fix. But still there may be different option. available. But not sure how to fix,

Here is my code outline.Hope this will help.

Main FM.

Loop internal table.(internal table has value A and B).

User exit.

BADI( i declared g_var in attribute)

Case A.

g_var = 'TEST'.

Case B

value = g_Var.( i expect 'TEST', but i am not getting anything just blank).

endloop.

Thanks,

Narayan