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: 

Question about ALV Toolbar

Former Member
0 Kudos
117

Hi friends,

I am learning OO ALV. Now, I am settin NO_TOOLBAR in my layout. And my ALV doesn't display my ALV toolbar (I am using OO ALV set_table_for_first_display) Now I am adding copy of a standard toolbar into my gui status. Now I want use this toolbar (sum, avg,filter and other) buttons. But when I press a button it isn't handling. How can I execute this standard button events for my ALV grid?

Thanks

Mehmet

7 REPLIES 7

Former Member
0 Kudos
68

Mehmet,

What you have added is to the screen, I don't think you have activated the Grid's toolbar. Activate the toolbar by not setting the NO_TOOLBAR option and then you will see the difference.

Regards,

Ravi

Note : Please mark the helpful answers, if they help.

Former Member
0 Kudos
68

Hi Mehmet,

You can do like this..

CLASS lcl_event_handler DEFINITION .
PUBLIC SECTION .
METHODS:
  handle_user_command
  FOR EVENT user_command OF cl_gui_alv_grid
  IMPORTING e_ucomm
ENDCLASS.
CLASS lcl_event_handler IMPLEMENTATION .
METHOD handle_user_command .
PERFORM handle_user_command USING e_ucomm .
ENDMETHOD.
ENDCLASS
DATA gr_event_handler TYPE REF TO lcl_event_handler .

*--Creating an instance for the event handler
CREATE OBJECT gr_event_handler .
*--Registering handler methods to handle ALV Grid events
SET HANDLER gr_event_handler->handle_user_command FOR gr_alvgrid .

then you can do..

FORM handle_user_command USING i_ucomm TYPE syucomm .
ENDFORM.

regards

satesh

0 Kudos
68

Thanks Satesh,

My request with image <a href="http://img164.imageshack.us/img164/1489/x1fq.jpg">My Request</a>

Can this code make my request?

0 Kudos
68

Hi Mehmet,

You can disable the standard toolbar buttons.

The method is as follows:

1) create a data type (say button_exclude ) of type UI_FUNCTIONS

2)call a method for disabling the buttons of std. toolbar.

perform exclude_std_buttons changing button_exclude.

3) in the form exclude_std_buttons,

do the following.

form exclude_std_buttons changing p_button_exclude type ui_functions.

data: ls_exclude type ui_func.

ls_exclude = cl_gui_alv_grid=>mc_fc_detail.

append ls_exclude to p_button_exclude.

ls_exclude = cl_gui_alv_grid=>mc_fc_find.

append ls_exclude to p_button_exclude.

ls_exclude = cl_gui_alv_grid=>mc_fc_filter.

append ls_exclude to p_button_exclude.

ls_exclude = cl_gui_alv_grid=>mc_fc_graph.

append ls_exclude to p_button_exclude.

ls_exclude = cl_gui_alv_grid=>mc_fc_sort_asc.

append ls_exclude to p_button_exclude.

endform.

4) In the function set_table_for_first_display, assign

it_toolbar_excluding = button_exclude

MC_FC_DETAIL,MC_FC_FIND are the IDs for the toolbar buttons.You can find the IDs for other buttons in SE24.

Goto se24 and type CL_GUI_ALV_GRID and goto attributes tab, you can find the IDs.

In this way , u can exclude standard toolbar buttons in ALV.

Regards,

Sylendra.

0 Kudos
68

Thanks Sylendra

But I want you suggesitons opposite ) I don't want using ALV's toolbar. I want using standard toolbar commands. I am disabling ALV toolbar (in layout I am using NO_Toolbar='X') and I want use standard toolbar commands. When I press a button on standard toolbar they cann't executing. How can I execute commands when user click a button on the standard toolbar?

P.S. Sorry I know my engslih not enough but i wish i can say my request in this topiz.

0 Kudos
68

Lonely I'm Mr lonely, I have nobody, to call my owwwn I’m so lonely... Ughh I am at SDN )

Friends I have found my solution at end ) Solution is :

MODULE USER_COMMAND_0100 INPUT.
  CASE SY-UCOMM.
    WHEN '&BACK' OR '&CANCEL' OR '&EXIT'.
      LEAVE TO SCREEN 0.

*--  A&#351;a&#287;&#305;daki komut ile standart toolbardaki çal&#305;&#351;t&#305;r&#305;lan komutlar&#305;n
*--  sistem taraf&#305;ndan otomatik gerçekle&#351;tirmesini sa&#287;l&#305;yoruz.
    WHEN OTHERS.
      CALL METHOD gr_alvgrid->set_function_code
        CHANGING
          c_ucomm = SY-UCOMM.
  ENDCASE.
ENDMODULE.                    "USER_COMMAND_0100 INPUT

0 Kudos
68

Great work Mehmet..

I haven't worked with the requirement that you gave in SDN. Now that you have solved the problem using the above-mentioned code. You have enhanced my idea about ALV by this way..

Thanks a lot buddy.

Regards,

Sylendra.