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 Toolbar refresh

Former Member
0 Likes
3,009

Hi again...

I want to update my ALV(OO)-Toolbar during runtime

Is there a method for this like SET_FRONTEND_FIELDCAT - for the fieldcatalog update?

I only found a INIT_TOOLBAR Method, this method is Private...

thanks in advance,

Sebastian

Hi again...

I want to update my ALV(OO)-Toolbar during runtime

Is there a method for this like SET_FRONTEND_FIELDCAT - for the fieldcatalog update?

I only found a INIT_TOOLBAR Method, this method is Private...

thanks in advance,

Sebastian

13 REPLIES 13
Read only

Former Member
0 Likes
2,176

Hi,

Could you pls. tell me what do you want to do at runtime ?.

Regs,

Venkat Ramanan

Read only

0 Likes
2,176

I want to exclude buttons from the ALV toolbar (delete row, add row,...)

I know how to exclude it on creating the ALV object but not during lifetime of the object...

Read only

Former Member
0 Likes
2,176

Hi,

may be you can do one thing, you can exclude the tool bar when ever you want to do it, and then refresh the alv grid using the method refresh.

CALL METHOD G_GRID->REFRESH_TABLE_DISPLAY
    EXCEPTIONS
      FINISHED = 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

vijay

Read only

0 Likes
2,176

vijay, tried refresh but this does only update the changed Fieldcat correctly...

Read only

0 Likes
2,176

Hi Sebastian,

when do you want to change the Toolbar. if you want to do tool bar refresh then you need to recall the grid , by clearing and free the container. and fill your exclude structure again and call the method.

  CALL METHOD G_GRID->SET_TABLE_FOR_FIRST_DISPLAY
    EXPORTING
      <b>IT_TOOLBAR_EXCLUDING = LT_EXCLUDE</b>
      IS_VARIANT           = LS_VARI
      IS_LAYOUT            = GS_LAYOUT
      I_SAVE               = 'A'
    CHANGING
      IT_FIELDCATALOG      = IT_FIELDCAT
      IT_OUTTAB            = IT_FINAL[].

regards

vijay

Read only

0 Likes
2,176

thanks, vijay...

I feared that this would be the only chance...

seems as If I have to do it this way now, but please keep looking for a better way

Read only

0 Likes
2,176

hi Sebastian ,

Instead of excluding the delete/add row button , u can make them disable.

Then u don't need the set table for first display method

Read only

0 Likes
2,176

do you have toolbar event handler. i hope you are having it. if so i was thinking why can't we try with that...

  METHOD HANDLE_TOOLBAR_SET.
*   create own Menubuttons and ToolbarButtons
*   append a separator to normal toolbar
    CLEAR GS_TOOLBAR.
    MOVE 3 TO GS_TOOLBAR-BUTN_TYPE.
    APPEND GS_TOOLBAR TO E_OBJECT->MT_TOOLBAR.
*   append detail button
    CLEAR GS_TOOLBAR.
    MOVE FCODE_DISP TO GS_TOOLBAR-FUNCTION.
    MOVE ICON_DETAIL TO GS_TOOLBAR-ICON.
    MOVE TEXT-005 TO GS_TOOLBAR-QUICKINFO.
    MOVE ' ' TO GS_TOOLBAR-DISABLED.
    APPEND GS_TOOLBAR TO E_OBJECT->MT_TOOLBAR.
*   append a separator to normal toolbar
    CLEAR GS_TOOLBAR.
    MOVE 3 TO GS_TOOLBAR-BUTN_TYPE.
    APPEND GS_TOOLBAR TO E_OBJECT->MT_TOOLBAR.
*   append new button
    CLEAR GS_TOOLBAR.
    MOVE FCODE_PLANE TO GS_TOOLBAR-FUNCTION.
    MOVE ICON_WS_PLANE TO GS_TOOLBAR-ICON.
    MOVE TEXT-002 TO GS_TOOLBAR-QUICKINFO.
    MOVE ' ' TO GS_TOOLBAR-DISABLED.
    APPEND GS_TOOLBAR TO E_OBJECT->MT_TOOLBAR.
  ENDMETHOD.

regards

vijay

Read only

0 Likes
2,176

thanks vijay think this could work, there is one problem now: the event is triggered somewhere in refresh_table_display... unfortunately this method also seems to overwrite my changes for the buttons... I tried to add a separator but the changes just don't work...

Read only

0 Likes
2,176

Is it so.

can you show how you tried...

and try this way also create the tool bar buttons , but hide them and in runtime using the event handler you enable them..

Regards

vijay

Message was edited by: Vijay Babu Dudla

Read only

0 Likes
2,176

coding is on another PC, but will give a short process flow:

change/display button -> change fieldcat and refresh table -> event toolbar is called -> adding a separator to provided reference of CL_ALV_EVENT_TOOLBAR_SET (debugger shows new value (the separator) in there)

just debugged the wohle thing, the toolbar event get raised 3 times, after the refresh of the table it is called the last time and the separator stays then in the toolbar table, but the ALV does not getting updated with that table, so is there an additional method to update the toolbar then?

Read only

0 Likes
2,176

vijay, unfortunately I can create new buttons with this, but I could not delete buttons from ALV, still have to exclude them on first display

Read only

Former Member
0 Likes
2,176

Hi,

Try this,



FORM exclude_tb_functions CHANGING pt_exclude TYPE ui_functions . 
DATA ls_exclude TYPE ui_func. 
ls_exclude = cl_gui_alv_grid=>mc_fc_maximum . 
APPEND ls_exclude TO pt_exclude. 
ls_exclude = cl_gui_alv_grid=>mc_fc_minimum . 
APPEND ls_exclude TO pt_exclude. 
ls_exclude = cl_gui_alv_grid=>mc_fc_subtot . 
APPEND ls_exclude TO pt_exclude. 
ls_exclude = cl_gui_alv_grid=>mc_fc_sum . 
APPEND ls_exclude TO pt_exclude. 
ls_exclude = cl_gui_alv_grid=>mc_fc_average . 
APPEND ls_exclude TO pt_exclude. 
ls_exclude = cl_gui_alv_grid=>mc_mb_sum . 
APPEND ls_exclude TO pt_exclude. 
ls_exclude = cl_gui_alv_grid=>mc_mb_subtot . 
ENDFORM .  
 
CALL METHOD G_GRID->SET_TABLE_FOR_FIRST_DISPLAY
    EXPORTING
      IT_TOOLBAR_EXCLUDING = pt_exclude
      IS_VARIANT           = LS_VARI
      IS_LAYOUT            = GS_LAYOUT
      I_SAVE               = 'A'
    CHANGING
      IT_FIELDCATALOG      = IT_FIELDCAT
      IT_OUTTAB            = IT_FINAL[].

Regards,

Venkat Ramanan