Skip to Content

Access global data of report in global class methods?


Hi all,

I have defined one global class in SE24 and i am using methods of this class in report program.

Can i access global data of my report program in class methods directly without declaring it as IMPORT

parameter?

Thanks,

Apita

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

4 Answers

  • Posted on Jul 23, 2014 at 04:42 AM

    Hi Rajkumar,

    Thanks for your reply.

    But I am using ABAP OOPS to develop this report.

    Or I have to declare it as IMPORT parameters in method?

    Regards,

    Arpita

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jul 23, 2014 at 04:45 AM

    Hi Arpita,

    As per my understanding you can't use the global variables. But you can use the field symbol concept to get the program variables in your global class. But again you have to modify the method. you can use the syntax :

    ASSIGN (PROGRAM(VARIABLE)) TO <FIeld symbol>.

    Rather I would suggest you to create two Function Module - one is SET FM and another GET FM under same function group.

    through the custom program you pass all the program variables to the global variables in the function group and you can call the GET FM in your class method to retrieve the same and use.

    Whenever you want to pass the additional variable and just change in the respective FM calls. You no need to change the import / export parameters of the method, as your class is global.

    Regards,

    Abhi

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jul 23, 2014 at 05:46 AM

    Hi,

    No, and you shouldn't even try 😊 Why, what's the difficulty in passing parameters?

    cheers

    Janis

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Arpita Save

      Hi Arpita,

      It wont be good design as class is global it should be independent.

      Create local class and inherit the the global class and redefine it according to program as global variable available in local class

      Thanks & Regards,

      Arun

  • Posted on Jul 23, 2014 at 06:51 AM

    Hi.

    Any attribute that have public visibility in your class is accessible from your program .

    So you can use those as "parameters" .

    Saying that it is exactly like using global variables which I hate .

    So please use method call .

    You can define the parameter types of your class in the class itself .

    See Y_R_EITAN_TEST_31_02_CL in


    http://scn.sap.com/community/abap/blog/2013/10/15/deeper-dive-into-deep-structure--part-2
    http://scn.sap.com/community/abap/blog/2013/10/09/deeper-dive-into-deep-structure

    Regards.

    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.