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

Button in alv cell

Former Member
0 Likes
11,572

Hi experts,

Is it possible to put a button is an alv cell, just like we put a icon?

Thanks.

Alexandre

1 ACCEPTED SOLUTION
Read only

former_member194669
Active Contributor
0 Likes
5,646

Hi,

Please check program BCALV_TEST_GRID

and also check for cl_gui_alv_grid=>mc_style_button

aRs

Hi experts,

Is it possible to put a button is an alv cell, just like we put a icon?

Thanks.

Alexandre

8 REPLIES 8
Read only

former_member194669
Active Contributor
0 Likes
5,647

Hi,

Please check program BCALV_TEST_GRID

and also check for cl_gui_alv_grid=>mc_style_button

aRs

Read only

Former Member
0 Likes
5,646

also you can copy the status gui using trx SE80

regards, Sebastiá

Read only

Former Member
0 Likes
5,646

Hi,

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'.

Pls. reward if useful...

Read only

0 Likes
5,646

Hi, I've used this and it worked well cl_gui_alv_grid=>MC_STYLE_BUTTON.

But I'm finding some dificult to handle the click event... it does not do anything...

Thanks.

Alexandre

Read only

0 Likes
5,646

I found it, the event BUTTON_CLICK.

Thanks for all the answers.

Alexandre

Read only

0 Likes
5,646

Hi,

how did you put an Icon on the button. I have Buttons but there is only the ID on them and not the Picture of the Icon.

Sinan

Read only

0 Likes
5,646

my field is a char(4), I just move the icon to this, and in the fieldcatalog I put the -datatype = 'ICON'.

Alexandre

Read only

Former Member
0 Likes
5,646

Hi,

To add a push button and handle it,you have to define a local class and use the methods <b>handle_toolbar</b> and <b>handle_user_command</b>.Here is a sample code:

----


  • CLASS lcl_eh DEFINITION

----


*

----


CLASS lcl_eh DEFINITION.

PUBLIC SECTION.

DATA:

<b>ls_toolbar TYPE stb_button.</b>

METHODS:

<b>handle_toolbar</b>

FOR EVENT toolbar OF cl_gui_alv_grid

IMPORTING e_object e_interactive,

<b>handle_user_command</b>

FOR EVENT user_command OF cl_gui_alv_grid

IMPORTING e_ucomm.

ENDCLASS. "lcl_eh DEFINITION

***********************************************************************

*Type referencing an object of the class

***********************************************************************

<b>DATA: lo_obj TYPE REF TO lcl_eh.</b>

----


  • CLASS lcl_eh IMPLEMENTATION

----


*

----


CLASS lcl_eh IMPLEMENTATION.

***********************************************************************

*METHOD: HANDLE_TOOLBAR

*DESCRIPTION: This method provides the necessary detail required to

  • create an extra button in the toolbar.

***********************************************************************

METHOD handle_toolbar.

CLEAR ls_toolbar.

MOVE 'CREATE' TO ls_toolbar-function.

<b>MOVE 0 TO ls_toolbar-butn_type.</b>

MOVE 'CREATE' TO ls_toolbar-text.

MOVE 'ICON_DETAIL' TO ls_toolbar-icon.

MOVE 'CREATE' TO ls_toolbar-quickinfo.

APPEND ls_toolbar TO e_object->mt_toolbar.

ENDMETHOD. "handle_toolbar

***********************************************************************

*METHOD: HANDLE_USER_COMMAND

*DESCRIPTION: This method is used to handle the push button

***********************************************************************

METHOD handle_user_command.

CASE e_ucomm.

WHEN 'CREATE'.

**logic

...

ENDCASE.

ENDMETHOD.

ENDCLASS.

Regards,

Beejal

**reward if this helps