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

alvs

Former Member
0 Likes
833

how to hide a button in alvs

1 ACCEPTED SOLUTION
Read only

dani_mn
Active Contributor
0 Likes
806

Hi, use 'IT_EXCLUDING' option to exclude buttons.

here is an example

DATA: IT_EXCL_BUTT type SLIS_T_EXTAB.
data: wa_excl_buttons type SLIS_EXTAB.


wa_excl_buttons-fcode = '&OUP'.
append wa_excl_buttons to it_excl_butt.
wa_excl_buttons-fcode = '&ODN'.
append wa_excl_buttons to it_excl_butt.
wa_excl_buttons-fcode = '&ILT'.
append wa_excl_buttons to it_excl_butt.
wa_excl_buttons-fcode = '&UMC'.
append wa_excl_buttons to it_excl_butt.




 CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
             i_callback_program = sy-repid
             i_callback_user_command = 'ITAB_USER_COMMAND'
             is_layout          = gs_layout
             i_background_id    ='CGA'
             IT_EXCLUDING       = it_excl_butt
             i_grid_title       ='Employee Cheque Advice'

             it_fieldcat        = it_fieldcat[]
             i_save             = g_save
             is_variant         = g_variant
             it_events          = gt_events[]
        TABLES
             t_outtab           = itab_post
        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.

Regards,

Wasim Ahmed

6 REPLIES 6
Read only

dani_mn
Active Contributor
0 Likes
807

Hi, use 'IT_EXCLUDING' option to exclude buttons.

here is an example

DATA: IT_EXCL_BUTT type SLIS_T_EXTAB.
data: wa_excl_buttons type SLIS_EXTAB.


wa_excl_buttons-fcode = '&OUP'.
append wa_excl_buttons to it_excl_butt.
wa_excl_buttons-fcode = '&ODN'.
append wa_excl_buttons to it_excl_butt.
wa_excl_buttons-fcode = '&ILT'.
append wa_excl_buttons to it_excl_butt.
wa_excl_buttons-fcode = '&UMC'.
append wa_excl_buttons to it_excl_butt.




 CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
             i_callback_program = sy-repid
             i_callback_user_command = 'ITAB_USER_COMMAND'
             is_layout          = gs_layout
             i_background_id    ='CGA'
             IT_EXCLUDING       = it_excl_butt
             i_grid_title       ='Employee Cheque Advice'

             it_fieldcat        = it_fieldcat[]
             i_save             = g_save
             is_variant         = g_variant
             it_events          = gt_events[]
        TABLES
             t_outtab           = itab_post
        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.

Regards,

Wasim Ahmed

Read only

Laxmana_Appana_
Active Contributor
0 Likes
806

Hi,

pass excluding buttons list to IT_TOOLBAR_EXCLUDING parameter of the Grid display method (Grid->SET_TABLE_FOR_FIRST_DISPLAY), fill the table IT_TOOLBAR_EXCLUDING with values MC_FC_SORT, MC_FC_SORT_ASC, MC_FC_SORT_DSC.. etc .

Regards

Appana

Read only

Former Member
Read only

Former Member
0 Likes
806

Hi Pavan,

If u r using FM u can use the above code but if u r using class do this way-

CALL METHOD ALV->SET_TABLE_FOR_FIRST_DISPLAY

EXPORTING

  • I_STRUCTURE_NAME =

IS_LAYOUT = GS_LAYOUT

IT_TOOLBAR_EXCLUDING = T_FILTER[]

CHANGING

IT_OUTTAB = T_EQUI_DET[]

IT_FIELDCATALOG = T_FIELDCAT[].

Hope this helps u.

Regards,

Seema.

Read only

Former Member
0 Likes
806

Hi Pavan,

U will get ur answer in this thread.

How to hide std buttons in ALV?

Rgds,

Prakash

<b>Reward useful answers</b>

Read only

Former Member
0 Likes
806

hi pavan,

Yes. Use the exclude functionality.

  • Optionally restrict generic functions to 'change only'.

DATA: LT_EXCLUDE TYPE UI_FUNCTIONS.

*

  • (The user shall not be able to add new lines).

*

PERFORM EXCLUDE_TB_FUNCTIONS CHANGING LT_EXCLUDE.

*

  • Set selection mode to "D" -- Multiple Lines

LAYOUT-SEL_MODE = 'D'.

CALL METHOD ALV_GRID->SET_TABLE_FOR_FIRST_DISPLAY

EXPORTING

IS_LAYOUT = LAYOUT

IT_TOOLBAR_EXCLUDING = LT_EXCLUDE

IS_VARIANT = VARIANT

I_SAVE = 'A'

I_STRUCTURE_NAME = 'IALV'

CHANGING

IT_OUTTAB = IALV[]

IT_FIELDCATALOG = FIELDCAT[].

*

*

FORM EXCLUDE_TB_FUNCTIONS CHANGING PT_EXCLUDE TYPE UI_FUNCTIONS.

  • Only allow to change data not to create new entries (exclude

  • generic functions).

DATA LS_EXCLUDE TYPE UI_FUNC.

LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_COPY_ROW.

APPEND LS_EXCLUDE TO PT_EXCLUDE.

LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_DELETE_ROW.

APPEND LS_EXCLUDE TO PT_EXCLUDE.

LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_APPEND_ROW.

APPEND LS_EXCLUDE TO PT_EXCLUDE.

LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_INSERT_ROW.

APPEND LS_EXCLUDE TO PT_EXCLUDE.

LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_MOVE_ROW.

APPEND LS_EXCLUDE TO PT_EXCLUDE.

ENDFORM.

You can find all of the function codes for the buttons in the class CL_GUI_ALV_GRID, look at the attributes tab, and check out all of the attributes that start with MC_FC*

or

depend on whick kind of ALV you're using.

In REUSE_ALV_LIST_DISPLAY and REUSE_ALV_GRID_DISPLAY you can use the parameter IT_EXCLUDING to indicate which buttons hve to be disactived.

In method SET_TABLE_FOR_FIRST_DISPLAY (of class CL_GUI_ALV_GRID) you can use the parameter IT_TOOLBAR_EXCLUDING.

Regards,

Naveen