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

ALV split using OOPs

Former Member
0 Likes
1,117

Hi Frnds,

I have a requirement in which I need to show 2 ALV grids in one screen and the have two different buttons on both the ALV grids.

I am able to split the ALV into two grids using the splitter but can only get the button on the first grid application toolbar, how do I get the button on the second grid application toolbar?

Is there anyway I can identify between the two grids at Method handle_toolbar?

Please help and reply.

Thanks,

3 REPLIES 3
Read only

naimesh_patel
Active Contributor
0 Likes
877

In addition to the explicity defined paramters of the method, you can add the SENDER in the signature fo the event handler method.


CLASS lcl_handlers DEFINITION. 
  PUBLIC SECTION. 
    METHODS handle_toolbar 
            FOR EVENT TOOLBAR OF CL_GUI_ALV_GRID 
            IMPORTING E_OBJECT 
                          E_INTERACTIVE 
                          sender. 
ENDCLASS. 

Check this from the online help:

If evt is an instance event, you can, in addition to the explicitly defined output parameters, define a formal parameter named sender as input parameter of an event handler. The formal parameter sender is an implicit output parameter or every instance event. It is typed fully as a reference variable, which has the class class or the interface ifac as a static type, as specified in the declaration of the event handler after EVENT evt OF. If the event handler is called by an instance event, a reference to the triggering object is passed to it in sender.

Regards,

Naimesh Patel

Read only

Former Member
0 Likes
877

Hi,

You need to create two object for the class CL_GUI_ALV_GRID two display two alv's in two different containers of the same screen.

While displaying the ALV using SET_TABLE_FOR_FIRST_DISPLAY you need to pass the IT_TOOLBAR_EXCLUDING parameter with the Function codes which of the button to be excluded.

Read only

Former Member
0 Likes
877

Try with two different objects for two grids while registering the events.

DATA: lp_adhoc TYPE REF TO 'your class',

lp_adhoc1 TYPE REF TO 'your class'.

After creating grid 1

CREATE OBJECT lp_adhoc.

SET HANDLER lp_adhoc->handle_user_command FOR w_adhe_gd1.

SET HANDLER lp_adhoc->handle_toolbar FOR w_adhe_gd1.

After creating grid 2

CREATE OBJECT lp_adhoc1.

SET HANDLER lp_adhoc1->handle_user_command FOR w_adhe_gd2.

SET HANDLER lp_adhoc1->handle_toolbar FOR w_adhe_gd2.