Application Development and Automation 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: 
Read only

local class inside abap report

Former Member
0 Likes
4,367

Can i access the classes inside abap report that i have been created from outside the report? if yes, how?

What are the differences between the classes i have been created by T-code (SE24)?

BR

Ali

1 ACCEPTED SOLUTION
Read only

naveen_inuganti2
Active Contributor
3,045

Hi,

The class which you create from the SE24 is global class. This you can use in any report.

For that you just need to declare one object for that class in your report and call the methods of this class via object by using PATTERN button.

Thanks,

Naveen Inuganti.

Hi,

The class which you create from the SE24 is global class. This you can use in any report.

For that you just need to declare one object for that class in your report and call the methods of this class via object by using PATTERN button.

Thanks,

Naveen Inuganti.

8 REPLIES 8
Read only

naveen_inuganti2
Active Contributor
3,046

Hi,

The class which you create from the SE24 is global class. This you can use in any report.

For that you just need to declare one object for that class in your report and call the methods of this class via object by using PATTERN button.

Thanks,

Naveen Inuganti.

Read only

uwe_schieferstein
Active Contributor
0 Likes
3,045

Hello Ali

Local classes are like "private attributes" of your report which cannot be accessed from outside the report.

Regards

Uwe

Read only

3,045

Hello Guys,

although I do not want to encourage this kind of local class usage, I have to disagree: Using local classes from other programs is possible using the absolute typename of the local class.

Program A defines a local class:


REPORT Z_REPORT_A.
  CLASS LCL_LOCAL_CLASS DEFINTION.
    PUBLIC SECTION.
      CLASS-METHODS say_foo.
  ENDCLASS.
  CLASS LCL_LOCAL_CLASS IMPLEMENTATION.
    METHOD say_foo.
      WRITE 'Foo from program Z_REPORT_A'.
    ENDMETHOD.
  ENDCLASS.

Program B can use this class:


REPORT Z_REPORT_B.
  START-OF-SELECTION.
    CALL METHOD ('\PROGRAM=Z_REPORT_A\CLASS=LCL_LOCAL_CLASS')=>('SAY_FOO').
            " --> writes 'Foo from program Z_REPORT_A'

Regards

David

Read only

0 Likes
3,045

Hello,

in a somwhat similar vein to David's example, you can also associate a transaction code (via se93) with an arbitrary method of a local class.

-- Sebastian

Read only

Former Member
0 Likes
3,045

Hi,

Classes created inside abap report are local and these cannot be accessed outside the report and Classes created using Tcode SE24 are Global.

Hope this clears your doubt.

Read only

MarcinPciak
Active Contributor
0 Likes
3,045

I think simply saying local and global is enough to describe how the class is threated inside and outside the report.

Everything which is local (i.e in a report) stays local for it, so as Uwe said is kind of "private" data for this report. Conversely, global stuff stay visible accross entire system, so for all the reports too.

An example of global definition are all types created in ABAP Dictionary. They are visible in all the programs in the system.

The same applies to global classes (which you create using se24). They are just a global type of objects which can be created locally in the report. You do the same i.e with table types. First you define strcutre/table type in the Dictionary, then in report you create a data object which is typed with the above. So strcutre/table type stays global, while data object you created in program is only visible at that place.

There is one handy tool in se24 which allows to derive global classes from local one .

I described it in [An easy way to create global class hierarchies|http://www.sdn.sap.com/irj/scn/weblogs?blog=/pub/wlg/13402] [original link is broken] [original link is broken] [original link is broken];

Regards

Marcin

Read only

0 Likes
3,045

... you can also use dynamic assign. I will not explain here.

There is a far better way. Not from my preferred transaction SE80, no. Now you have to use SE24. From the start screen use menu Object type -> Import -> local classes in program.

Give the program name, if required 'explode includes'. Mark the local class name(s) found, give it the global name(s). Then click the import button at the bottom of the popup.

When you try to activate you may face errors because in programs local classes methods you can use programs global data. This will not work here and will cause errors using the local class methods externally because the global data are not set and may create havoc.

Regards,

Clemens

Read only

Former Member
0 Likes
3,045

thanks all