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: 

ALV object model: how to reference a not global data internal tab

Former Member
0 Kudos

Hi all,

i'm using class CL_SALV_TABLE for creating a simple two-dimensional table; I added some custom buttons in toolbar which are handled by a local class.

Is there some method or another way to reference the internal table containing the data in the local class used for handling events ?

I know that a solution is to use a global internal table so to be accessible in every environment in the program: but how when the internal table used by the main class is not global ?

Thanks in advance,

Antonio

1 REPLY 1

Clemenss
Active Contributor
0 Kudos

Hi,

you can always declare a reference variable and use it like

data:
  gr_tab type ref to data.

...
get reference of lt_whatever into gr_tab.

...

Field-symbols:
  <tab> type table.
...
assign gr_tab->* to <tab>.
if sy-subrc = 0.
  loop at <tab> ...
..
endif.

I don't know much about your specific task, but the use of reference variables allows you to access any kind of data anywhere. You could declare a class as a container with just a get and a set method for the attribute to store the reference.

Regards,

Clemens