2008 Nov 10 3:19 PM
A push button has been assigned to a cell in alv grid.
How to assign a function code to this button and call it in the program?
Thanks,
Ven
2008 Nov 10 3:50 PM
http://help.sap.com/saphelp_erp2004/helpdata/en/88/387f380c2f2e3ce10000009b38f8cf/content.htm.
Try,
set icon fields for all fields that contains the ICON in their name!
CLEAR ls_fcat.
ls_fcat-icon = c_checked.
ls_fcat-edit = 'X'.
ls_fcat-style = ls_fcat-style bit-xor
cl_gui_alv_grid=>MC_STYLE_BUTTON bit-xor
cl_gui_alv_grid=>MC_STYLE_ENABLEd.
MODIFY exi_fieldcat FROM ls_fcat TRANSPORTING icon
WHERE fieldname CS 'ICON'.
OR
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.
A push button has been assigned to a cell in alv grid.
How to assign a function code to this button and call it in the program?
Thanks,
Ven
2008 Nov 10 3:24 PM
2008 Nov 10 3:29 PM
Hi,
There will be a Function Code assigned to the PushButton.
Trap the Function Code in the SY-UCOMM in Exit Subroutine "USER_COMMAND", and put your code inside that.
2008 Nov 10 3:50 PM
http://help.sap.com/saphelp_erp2004/helpdata/en/88/387f380c2f2e3ce10000009b38f8cf/content.htm.
Try,
set icon fields for all fields that contains the ICON in their name!
CLEAR ls_fcat.
ls_fcat-icon = c_checked.
ls_fcat-edit = 'X'.
ls_fcat-style = ls_fcat-style bit-xor
cl_gui_alv_grid=>MC_STYLE_BUTTON bit-xor
cl_gui_alv_grid=>MC_STYLE_ENABLEd.
MODIFY exi_fieldcat FROM ls_fcat TRANSPORTING icon
WHERE fieldname CS 'ICON'.
OR
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.
2008 Nov 10 6:33 PM
I am trying to use teh hotspot from the output of REUSE_ALV_GRID_DISPLAY_LVC. I tried the above suggestions, but I am getting a short dump for the set handler part - saying that the handler can not be null.
Not sure what went wrong??
2008 Nov 10 7:27 PM
BCALV_VERIFY_DATATYPES has a very good reference. used parts of the code and solved my issue
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |