Application Development and Automation 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: 
Read only

column as pushbutton in alv

Former Member
0 Likes
2,107

Hi all,

i want to know the moethod by which we can display a coulumn as pushbutton in alv when we are usingFM Reuse_alv_list_display.. to display ALV...

if possible then give me some sample code

Regards,

Syed

Hi all,

i want to know the moethod by which we can display a coulumn as pushbutton in alv when we are usingFM Reuse_alv_list_display.. to display ALV...

if possible then give me some sample code

Regards,

Syed

6 REPLIES 6
Read only

Former Member
0 Likes
1,419

1.Have an extra field in your internal table, (ex: box)

2. Now mention the Field as Box field in the layout.

layout-box_fieldname = 'BOX'. "from step 1

3, pass this layout to the alv function parameter.

you can see a button.

is that you are expecting..

or if you want a button in the column then using this function module it is not possible. using LVC Function or OO ALV it is possible.

Read only

Former Member
Read only

Former Member
0 Likes
1,419

Hi,

To display all cells of a column as pushbuttons, you use the field STYLE of the field catalog.

Regards,

Vijetha.

Read only

Former Member
0 Likes
1,419

hi syed

include this class in you program

INCLUDE <cl_alv_control>.

by dbl clicking this you find ALV_STYLE_BUTTON

using this we can show the column as button

Hope it will help you

regards

deva

Read only

Former Member
0 Likes
1,419

Check This example which shows button in a cell

REPORT ZTESTALV.

type-pools: slis.

*Fieldcatalog
data: it_fieldcat type lvc_t_fcat,
it_fieldcat1 type slis_t_fieldcat_alv..

*For Events
data:it_events type slis_t_event.

data: x_fieldcat type lvc_s_fcat,
x_fieldcat1 type slis_fieldcat_alv.
data:x_layout type lvc_s_layo.

data: begin of it_vbap occurs 0,
vbeln like vbap-vbeln,
posnr like vbap-posnr,
button(10),
end of it_vbap.
data: ls_outtab like line of it_vbap.
select vbeln
posnr
up to 10 rows
into corresponding fields of table it_vbap
from vbap.

data:l_pos type i value 1.
clear: l_pos.
l_pos = l_pos + 1.

x_fieldcat-seltext = 'Button'.
x_fieldcat-fieldname = 'BUTTON'.
x_fieldcat-tabname = 'ITAB'.
x_fieldcat-icon = 'X'.
x_fieldcat-col_pos = l_pos.
x_fieldcat-outputlen = '10'.

x_fieldcat-style = x_fieldcat-style bit-xor
cl_gui_alv_grid=>mc_style_button bit-xor
cl_gui_alv_grid=>mc_style_enabled.
append x_fieldcat to it_fieldcat.
clear x_fieldcat.

l_pos = l_pos + 1.


x_fieldcat-seltext = 'VBELN'.
x_fieldcat-fieldname = 'VBELN'.
x_fieldcat-tabname = 'ITAB'.
x_fieldcat-col_pos = l_pos.
x_fieldcat-edit = 'X'.
x_fieldcat-outputlen = '10'.
x_fieldcat-ref_field = 'VBELN'.
x_fieldcat-ref_table = 'VBAK'.
append x_fieldcat to it_fieldcat.
clear x_fieldcat.
l_pos = l_pos + 1.

x_fieldcat-seltext = 'POSNR'.
x_fieldcat-fieldname = 'POSNR'.
x_fieldcat-tabname = 'ITAB'.
x_fieldcat-col_pos = l_pos.
x_fieldcat-outputlen = '5'.
append x_fieldcat to it_fieldcat.
clear x_fieldcat.
l_pos = l_pos + 1.

call function 'REUSE_ALV_GRID_DISPLAY_LVC'
  exporting
    i_callback_program = sy-repid
    is_layout_lvc      = x_layout
    it_fieldcat_lvc    = it_fieldcat
  tables
    t_outtab           = it_vbap[]
  exceptions
    program_error      = 1
    others             = 2.
if sy-subrc eq 0.

endif.

Read only

Former Member
0 Likes
1,419

This message was moderated.