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: 

OO ALV pf-status problem

Former Member
0 Kudos

Hi friends,

in oo alv when after you run the report, you see the default pf-elements like 'copy text','insert with overwrite','insert row', 'delete row',duplicate row',etc...

I dont want these items to display. How can i get rid of them? Any way please?

Thanks in advance.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi,

Before Displaying the ALV list you can write a subroutine to hide the toolbar buttons.

Here is the sample code:-

perform f_set_grid_toolbar changing g_t_toolbar_func.

FORM f_set_grid_toolbar CHANGING p_toolbar_func TYPE ui_functions.

DATA : g_t_toolbar_func TYPE ui_functions,

wa_toolbar_func TYPE UI_FUNC.

wa_toolbar_func = CL_GUI_ALV_GRID=>MC_FC_LOC_INSERT_ROW.

APPEND wa_toolbar_func TO p_toolbar_func.

wa_toolbar_func = CL_GUI_ALV_GRID=>MC_FC_LOC_DELETE_ROW.

APPEND wa_toolbar_func TO p_toolbar_func.

wa_toolbar_func = CL_GUI_ALV_GRID=>MC_FC_LOC_COPY_ROW.

APPEND wa_toolbar_func TO p_toolbar_func.

wa_toolbar_func = CL_GUI_ALV_GRID=>MC_FC_LOC_PASTE_NEW_ROW.

APPEND wa_toolbar_func TO p_toolbar_func.

"you can find more attributes in the CL_GUI_ALV_GRID class"

ENDFORM.

and write call method set_table_for_first_display

CALL METHOD o_grid->set_table_for_first_display " o_grid is the instance for class CL_GUI_ALV_GRID

EXPORTING

is_variant = wa_variant

i_save = 'A'

is_layout = "work area for layout

it_toolbar_excluding = g_t_toolbar_func

CHANGING

it_outtab = "output table for display

it_fieldcatalog = " internal table for field catalog

EXCEPTIONS

invalid_parameter_combination = 1

program_error = 2

too_many_lines = 3

OTHERS = 4.

Let me know if it is helpful.

Thanks.....

3 REPLIES 3

Former Member
0 Kudos

You could have easily got the solution by searching for existing answers...

Former Member
0 Kudos

Hi,

Before Displaying the ALV list you can write a subroutine to hide the toolbar buttons.

Here is the sample code:-

perform f_set_grid_toolbar changing g_t_toolbar_func.

FORM f_set_grid_toolbar CHANGING p_toolbar_func TYPE ui_functions.

DATA : g_t_toolbar_func TYPE ui_functions,

wa_toolbar_func TYPE UI_FUNC.

wa_toolbar_func = CL_GUI_ALV_GRID=>MC_FC_LOC_INSERT_ROW.

APPEND wa_toolbar_func TO p_toolbar_func.

wa_toolbar_func = CL_GUI_ALV_GRID=>MC_FC_LOC_DELETE_ROW.

APPEND wa_toolbar_func TO p_toolbar_func.

wa_toolbar_func = CL_GUI_ALV_GRID=>MC_FC_LOC_COPY_ROW.

APPEND wa_toolbar_func TO p_toolbar_func.

wa_toolbar_func = CL_GUI_ALV_GRID=>MC_FC_LOC_PASTE_NEW_ROW.

APPEND wa_toolbar_func TO p_toolbar_func.

"you can find more attributes in the CL_GUI_ALV_GRID class"

ENDFORM.

and write call method set_table_for_first_display

CALL METHOD o_grid->set_table_for_first_display " o_grid is the instance for class CL_GUI_ALV_GRID

EXPORTING

is_variant = wa_variant

i_save = 'A'

is_layout = "work area for layout

it_toolbar_excluding = g_t_toolbar_func

CHANGING

it_outtab = "output table for display

it_fieldcatalog = " internal table for field catalog

EXCEPTIONS

invalid_parameter_combination = 1

program_error = 2

too_many_lines = 3

OTHERS = 4.

Let me know if it is helpful.

Thanks.....

Former Member
0 Kudos

Hello,

you can delete pf-functions you don't want like this:


* Define a handle event:
CLASS lcl_event_receiver DEFINITION.
  PUBLIC SECTION.
 METHODS: handle_toolbar_set
      FOR EVENT toolbar OF cl_gui_alv_grid
      IMPORTING e_object e_interactive.
ENDCLASS.

* Implement the handle event
CLASS lcl_event_receiver IMPLEMENTATION.
METHOD handle_toolbar_set.
    DATA: ls_toolbar TYPE stb_button.

    DELETE e_object->mt_toolbar WHERE function = '&LOCAL&INSERT_ROW'.
    DELETE e_object->mt_toolbar WHERE function = '&LOCAL&DELETE_ROW'.
    DELETE e_object->mt_toolbar WHERE function = '&LOCAL&COPY_ROW'.
    DELETE e_object->mt_toolbar WHERE function = '&LOCAL&CUT'.
    DELETE e_object->mt_toolbar WHERE function = '&LOCAL&COPY'.
    DELETE e_object->mt_toolbar WHERE function = '&LOCAL&PASTE'.
    DELETE e_object->mt_toolbar WHERE function = '&LOCAL&APPEND'.
    DELETE e_object->mt_toolbar WHERE function = '&VIEW'.
    DELETE e_object->mt_toolbar WHERE function = '&COL0'.
    DELETE e_object->mt_toolbar WHERE function = '&INFO'.
    DELETE e_object->mt_toolbar WHERE function = '&GRAPH'.

ENDMETHOD.
ENDCLASS.

DATA: d_cl_event_receiver TYPE REF TO lcl_event_receiver.

* set the handle event
 CREATE OBJECT d_cl_event_receiver.
    SET HANDLER d_cl_event_receiver->handle_toolbar_set
              FOR gr_alvgrid.