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 grid control

Former Member
0 Likes
489

Hi,

Is there any event which triggers when standard toolbar icon such as insert or append button is clicked. I tried using user_command, MENU_BUTTON, TOOLBAR_BUTTON_CLICK. none of them triggers when standard button is clicked.

Regards

Rakesh

Hi,

Is there any event which triggers when standard toolbar icon such as insert or append button is clicked. I tried using user_command, MENU_BUTTON, TOOLBAR_BUTTON_CLICK. none of them triggers when standard button is clicked.

Regards

Rakesh

3 REPLIES 3
Read only

anversha_s
Active Contributor
0 Likes
457
Read only

uwe_schieferstein
Active Contributor
0 Likes
457

Hello Rakesh

Have a look at sample report

BCALV_GRID_05

with the following documentation in the header:

PROGRAM BCALV_GRID_05.
*&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
* Purpose:
* ~~~~~~~~
* Demonstrate the creation of an own toolbar button.
*-----------------------------------------------------------------
* To check program behavior
* ~~~~~~~~~~~~~~~~~~~~~~~~~
* The report shows a list of flights of one airline.
* Select one or more lines and press the 'Detail'-Button to popup
* a dialog window with related bookings.
*-------------------------------------------------------------------
* Essential steps (Search for '§')
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* 1.Apply steps for event handling for events TOOLBAR and
*   USER_COMMAND (see example for print events)
* 2.In event handler method for event TOOLBAR: Append own functions
*   by using event parameter E_OBJECT.
* 3.In event handler method for event USER_COMMAND: Query your
*   function codes defined in step 2 and react accordingly.
* 4.Call method 'set_toolbar_interactive' to raise event TOOLBAR.
*&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
...

The crucial points are:

(1) Define event handler method

* Definition:
* ~~~~~~~~~~~
CLASS lcl_event_receiver DEFINITION.

  PUBLIC SECTION.

    METHODS:
    handle_toolbar
        FOR EVENT toolbar OF cl_gui_alv_grid
            IMPORTING e_object e_interactive,

    handle_user_command
        FOR EVENT user_command OF cl_gui_alv_grid
            IMPORTING e_ucomm.

  PRIVATE SECTION.

ENDCLASS.


(2) Register event handler method

********
* ->Create Object to receive events and link them to handler methods.
* When the ALV Control raises the event for the specified instance
* the corresponding method is automatically called.
*
    CREATE OBJECT event_receiver.
    SET HANDLER event_receiver->handle_user_command FOR grid1.
    SET HANDLER event_receiver->handle_toolbar FOR grid1.

Regards

Uwe

Read only

Former Member
0 Likes
457