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: 

Hiding default alv grid toolbar

Former Member
0 Kudos

Hi.

is there any way to hide the standard toolbar of an alv grid (cl_gui_alv_grid)

Thanks.

1 ACCEPTED SOLUTION

Former Member

Hi,

The code i previously pasted is to hide only some icons in tool bar.

If you want to hide the entire tool bar

Declare for the layout which you will use in grid display,

DATA: g_r_layo TYPE lvc_s_layo, "Layout structure

then use

<b>g_r_layo-no_toolbar = 'X'.</b>

then toolbar will not display.

Then pass this to the method

CALL METHOD g_r_grid->set_table_for_first_display

EXPORTING

i_buffer_active = 'X'

is_variant = g_r_variant

i_save = 'X'

i_default = 'X'

<b> is_layout = g_r_layo</b>

CHANGING

it_outtab = <it_disptab>

it_fieldcatalog = g_t_fieldcat.

Hope this will solve your problem.

<b>Reward if helpful.</b>

7 REPLIES 7

Former Member
0 Kudos

YES it can be done in the following way..

loop at toolbar.

toolbar-itemname = 'xxxxxxxx'

toolarbar-invisible = 1.

endloop.

i dont know the exact code but i am sure that can be done in this way..

reward points if helpful...

Former Member
0 Kudos

Hi,

see below example:

 
ls_layout-no_toolbar = ' '.
*create the fieldcatalog e.g. which fields to display
    perform create_fieldcat.
*display the data in the ALV control
    my_alv->set_table_for_first_display(
                exporting
                    i_save        =  'A'
                    is_variant    =  ls_variant
                    is_layout     =  ls_layout
                changing
                    it_outtab         =  gt_equnr
                    it_fieldcatalog   =  lt_fieldcat ).

Cheers.

Former Member
0 Kudos

Hi,

You have to append the functions you want to hide in this and pass it to the method g_r_grid->set_table_for_first_display

<b>it_toolbar_excluding = g_r_excl</b>

Ex:

----


*Form Routine ID : alv_excl

*Form Routine Name : ALV Exclude List

*Outline : Subroutine to exclude process options from ALV

----


FORM alv_excl.

APPEND CL_GUI_ALV_GRID=>MC_FC_SUM TO g_r_excl.

APPEND CL_GUI_ALV_GRID=>MC_FC_SUBTOT TO g_r_excl.

APPEND CL_GUI_ALV_GRID=>MC_FC_HELP TO g_r_excl.

APPEND cl_gui_alv_grid=>mc_fc_detail TO g_r_excl.

ENDFORM. " alv_excl

<b>Reward if helpful.</b>

Former Member

Hi,

The code i previously pasted is to hide only some icons in tool bar.

If you want to hide the entire tool bar

Declare for the layout which you will use in grid display,

DATA: g_r_layo TYPE lvc_s_layo, "Layout structure

then use

<b>g_r_layo-no_toolbar = 'X'.</b>

then toolbar will not display.

Then pass this to the method

CALL METHOD g_r_grid->set_table_for_first_display

EXPORTING

i_buffer_active = 'X'

is_variant = g_r_variant

i_save = 'X'

i_default = 'X'

<b> is_layout = g_r_layo</b>

CHANGING

it_outtab = <it_disptab>

it_fieldcatalog = g_t_fieldcat.

Hope this will solve your problem.

<b>Reward if helpful.</b>

Former Member
0 Kudos

hii...

its very simple... just use PF-STATUS..

Ur default alv grid will hide..

Former Member
0 Kudos

FOR EXAMPLE I M GIVING YOU THE CODE

JUST USE IT

I HV HIDE THE TOOL BAR..

REPORT ZRJ_ALV_01.

TYPE-POOLS: SLIS.

TABLES: sflight.

SELECT-OPTIONS : S_CARRID FOR SFLIGHT-CARRID.

data: IT_SFLIGHT type STANDARD TABLE OF sflight,

wa_sflight like LINE OF IT_SFLIGHT.

SELECT * from sflight into TABLE IT_SFLIGHT where carrid IN S_CARRID.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY' " OR "'REUSE_ALV_GRID_DISPLAY'

EXPORTING

<b> I_CALLBACK_PF_STATUS_SET = 'SET_STATUS'</b>

I_STRUCTURE_NAME = 'SFLIGHT'

TABLES

T_OUTTAB = IT_SFLIGHT

EXCEPTIONS

PROGRAM_ERROR = 1

OTHERS = 2

.

IF SY-SUBRC <> 0.

MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

<b>FORM SET_STATUS USING RT TYPE SLIS_T_EXTAB .

SET PF-STATUS 'STAT'.

ENDFORM.</b>

0 Kudos

Thanks ur feedback helps me a lot .