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: 

how to add pushbutton to a alv-grid-column ??

Former Member
0 Kudos

hi,

i have an alv grid, called with FM REUSE_ALV_GRID_DISPLAY (NOT OO !!!).

now i want to display a column as pushbutton with a flexible text in the button.

well, i know that i can use the fieldcatalog-ICON = 'X' and fieldcatalog-HOTSPOT = 'X'.

there i can display an sap-ICON which can be pushed.

but how can i add a pushbutton with my own text in there ?

reg, Martin

4 REPLIES 4

Former Member
0 Kudos

Hi!

Unfortunately no way to enter pushbuttons into a column within an ALV.

You have the following options:

- enter some text into the column and underline it, so it will look like a hyperlink (use WRITE statement)

- enter an icon into the column (with the WRITE ... AS ICON statement).

You can handle the click on the column with a coding like this (refer to the link):

/community

Regards

Tamá

0 Kudos

thanks a lot.

but the link is not working. it brings me to sdn forum main menu

reg, martin

0 Kudos

one more thing:

i cant use WRITE.........AS ICON !

i have to put the value to the table-field of the alv-grid-table !

write .......... as icon is only for list-output !

reg, Martin

Former Member
0 Kudos

Hi Mike,

Add a User Command Code to your ALV GUI Status against F2 function key and then you can trap that event in your User command subroutine that is associated with your ALV list and code accordingly.

In the following example i_event internal table holds User_command event ( You can pass the subroutine name directly also in the exporting parameter "I_CALLBACK_USER_COMMAND")

CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'

EXPORTING

i_callback_program = v_repid

i_callback_pf_status_set = 'STANDARD'

is_layout = wa_layout

it_fieldcat = i_fieldcat

i_default = 'X'

i_save = 'A'

it_events = i_event

TABLES

t_outtab = fp_i_final

EXCEPTIONS

program_error = 1

OTHERS = 2.

FORM user_command USING fp_v_ucomm LIKE sy-ucomm

fp_selfield TYPE slis_selfield.

CASE fp_v_ucomm.

WHEN '&IC1'. " This is the code for F2 Function key set in

"GUI Status

*****CODE GOES HERE.

ENDFORM.

Hope it helps.

Regards,

Rudra