‎2009 Apr 03 2:24 PM
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,
‎2009 Apr 03 3:12 PM
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
‎2009 Apr 03 3:27 PM
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.
‎2009 Apr 03 3:35 PM
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.