Application Development 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: 

Need to add a push button with images to the ALV Grid Output

Former Member
0 Kudos

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

5 REPLIES 5

Former Member
0 Kudos

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

Former Member
0 Kudos

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

0 Kudos

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

0 Kudos

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

sbhutani1
Contributor
0 Kudos

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>