cancel
Showing results for 
Search instead for 
Did you mean: 

adding button to an alv

Former Member
0 Kudos

Hi,

i need to add 'UPDATE' button at the bottom of the ALV . i.e within the ALV. please help me out.

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Try with this:

CLASS cl_event_receiver DEFINITION.
PUBLIC SECTION.
  DATA: ucomm TYPE sy-ucomm.
*   toolbar
METHODS handle_toolbar_set
    FOR EVENT toolbar OF cl_gui_alv_grid
    IMPORTING e_object e_interactive.
*   user command
METHODS handle_user_command
    FOR EVENT user_command OF cl_gui_alv_grid
    IMPORTING e_ucomm.

CLASS cl_event_receiver IMPLEMENTATION.
METHOD handle_user_command.
  CASE e_ucomm.
    WHEN text-024.
      PERFORM upload_id.
    WHEN OTHERS.
  ENDCASE.
ENDMETHOD.   
METHOD handle_toolbar_set.
* append a separator to normal toolbar
  CLEAR ls_toolbar.
  MOVE 3 TO ls_toolbar-butn_type.
  APPEND ls_toolbar TO e_object->mt_toolbar.
CLEAR ls_toolbar.
  MOVE :text-032 TO ls_toolbar-function,
*" function code of the push button

        text-033 TO ls_toolbar-text.
*"text that will be displayed on the push button
  APPEND ls_toolbar    TO e_object->mt_toolbar.
ENDMETHOD.
ENDCLASS.
*set even handlers
SET HANDLER event_receiver1->handle_toolbar_set  FOR g_grid1.
SET HANDLER event_receiver1->handle_user_command FOR g_grid1.

You can also add the button to a DynproStatus, and set it before ALV initialization.

ps. This is the wrong forum session (please, move this 3D to Abap Area).