PUSH BUTTON ON ALV GRID OUTPUT SAMPLE CODE

You can add a push button using following steps:

1. Add push button in the tool bar
2.Trigger subroutine when push button is clicked
3. execute the code

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.
RELATED POST

ALV GRID DISPLAY WITH OOPS

General ledger balance report in mysap.com

General ledger account balance report for fico of sap abap

fico general ledger line items for mysap erp

General ledger account balance report of ABAP

No comments:

Post a Comment