Skip to Content
author's profile photo Former Member
Former Member

How to declare Global variable in BADI

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

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

4 Answers

  • Posted on May 26, 2011 at 11:46 PM

    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

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on May 27, 2011 at 03:06 AM

    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.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on May 27, 2011 at 05:15 PM

    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

    Add a comment
    10|10000 characters needed characters exceeded

    • 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...

  • author's profile photo Former Member
    Former Member
    Posted on May 27, 2011 at 07:58 PM

    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

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.