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

ALV : hide standard button

Former Member
0 Likes
1,230

Hi,

is it possible to hide button in standard ALV ?

Thanks

Regards,

1 ACCEPTED SOLUTION
Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
634

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).
*
<b>  PERFORM EXCLUDE_TB_FUNCTIONS CHANGING LT_EXCLUDE.</b>
*

* Set selection mode to "D"  --  Multiple Lines
  LAYOUT-SEL_MODE = 'D'.

  CALL METHOD ALV_GRID->SET_TABLE_FOR_FIRST_DISPLAY
      EXPORTING
           IS_LAYOUT              = LAYOUT
<b>           IT_TOOLBAR_EXCLUDING   = LT_EXCLUDE</b>
           IS_VARIANT             = VARIANT
           I_SAVE                 = 'A'
           I_STRUCTURE_NAME       = 'IALV'
      CHANGING
           IT_OUTTAB       = IALV[]
           IT_FIELDCATALOG = FIELDCAT[].
*
*

<b>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.</b>

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*

Regards,

Rich Heilman

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).
*
<b>  PERFORM EXCLUDE_TB_FUNCTIONS CHANGING LT_EXCLUDE.</b>
*

* Set selection mode to "D"  --  Multiple Lines
  LAYOUT-SEL_MODE = 'D'.

  CALL METHOD ALV_GRID->SET_TABLE_FOR_FIRST_DISPLAY
      EXPORTING
           IS_LAYOUT              = LAYOUT
<b>           IT_TOOLBAR_EXCLUDING   = LT_EXCLUDE</b>
           IS_VARIANT             = VARIANT
           I_SAVE                 = 'A'
           I_STRUCTURE_NAME       = 'IALV'
      CHANGING
           IT_OUTTAB       = IALV[]
           IT_FIELDCATALOG = FIELDCAT[].
*
*

<b>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.</b>

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*

Regards,

Rich Heilman

3 REPLIES 3
Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
635

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).
*
<b>  PERFORM EXCLUDE_TB_FUNCTIONS CHANGING LT_EXCLUDE.</b>
*

* Set selection mode to "D"  --  Multiple Lines
  LAYOUT-SEL_MODE = 'D'.

  CALL METHOD ALV_GRID->SET_TABLE_FOR_FIRST_DISPLAY
      EXPORTING
           IS_LAYOUT              = LAYOUT
<b>           IT_TOOLBAR_EXCLUDING   = LT_EXCLUDE</b>
           IS_VARIANT             = VARIANT
           I_SAVE                 = 'A'
           I_STRUCTURE_NAME       = 'IALV'
      CHANGING
           IT_OUTTAB       = IALV[]
           IT_FIELDCATALOG = FIELDCAT[].
*
*

<b>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.</b>

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*

Regards,

Rich Heilman

Read only

Former Member
0 Likes
634

Hi

Yes! but 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.

Max

Read only

0 Likes
634

Thanks so much to both