05-11-2006 7:46 PM
Hi,
I have implemented an ALV Grid output with cl_gui_alv_grid. I need to add a push button logic such that it has an event associated with it. So that I can do further screen level processing. I have added a pushbutton mc_style_button to it. But still Iam not able to add yes, no kind of symbole to it.
regards,
Rahul
05-12-2006 1:46 AM
Rahul,
I am assuming that you have changed the appearance of a column to look like a button. In that case I am not sure if you can write text on that.
However, what you can do is to make it an icon instead of a button. Now, you can display whatever ICON for each row of the grid. Have the HOTSPOT event active for the column so that the user clicks and you can do the required action on that column.
Regards,
Ravi
Note : Please mark the helpful answers
05-12-2006 2:34 AM
HI,
Thanks for the reply...
Actually I want the ICON_OKAY and ICON_CANCEL on the button as image, while button click event will generate the functionality of modifying a database table.
So, I wanted to know is it possible to have such kind of icons available on the buttons in ALV display..
regards,
Rahul
05-12-2006 4:45 AM
hi,
u need a cell of the alv table to be displayed as a push button or
u need a pushbutton to be displayed out side the table?
if u need it outside, y dont u go for tool bar.
FORM handle_toolbar using i_object type ref to cl_alv_toolbar_event_set.
data ls_toolbar type <b>stb_button</b>
check STB_BUTTON structure, in that u can find <b>butn_type,ICON</b> field,
if butn_type = 0, it becomes a push button.
move icon_okay or icon_cancel to ICON field and append to i_object->mt_toolbar.
ex:
ls_toolbar-butn_typ = 0.
ls_toolbar-icon = icon_okay.
append ls_toolbar to i_object->mt_toolbar.
u can add function codes also and handle them with user_command
05-12-2006 5:51 AM
Rahul,
Yes you can put in the ICON_OKAY AND ICON_CANCEL on the column and just activate the ICON field in the field catalog and populate the icon in the column.
Activate the hotspot and when clicked you can do whatever you want on a individual row basis.
If you want at report level add push buttons to the toolbar and when clicked, you can do your operations.
Regards,
Ravi
Note : Please mark the helpful answers
05-12-2006 5:13 AM
Hi rahul,
You can try this code
data: gs_toolbar TYPE stb_button,
CLEAR gs_toolbar.
MOVE 3 TO gs_toolbar-butn_type.
APPEND gs_toolbar TO e_object->mt_toolbar.
*...................
append a menu with default button (Type 1)
If the user klicks on the menu button ALV raises event MENU_BUTTON.
CLEAR gs_toolbar.
MOVE 'DISPL' TO gs_toolbar-function.
MOVE icon_display TO gs_toolbar-icon.
MOVE text-090 TO gs_toolbar-quickinfo.
MOVE 0 TO gs_toolbar-butn_type.
MOVE space TO gs_toolbar-disabled.
APPEND gs_toolbar TO e_object->mt_toolbar.
Hope this will help you
Regards
Sumit Bhutani
<b>Ps Reward points if helpful</b>