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: 

(UN)SET HANDLER GR_EVENT_HANDLER->HANDLE_TOOLBAR FOR GRID?

Former Member
0 Kudos

Hi All

I created an extra button for screen 100 ALV Grid with CLASS LCL_EVENT_HANDLER METHODS HANDLE_TOOLBAR FOR EVENT TOOLBAR and after pushing the button, posting is done and screen 200 is displayed with information of posting. Now when user pushes BACK button, I'd like to remove this button from screen 100 ALV grid TOOLBAR, but I'm not sure how to achieve this? I checked CL_GUI_ALV_GRID for a method to clear the TOOLBAR entry I added, but cannot find such a method? If you know a way to clear this pushbutton or a workaround, please advise.

Thank you and best regards,

Adrian

3 REPLIES 3

Former Member
0 Kudos

Hi,

ls_toolbar-disabled = 'X'

You can set the disabled flag = 'X'. when user press the back button then set a flag and use the same flag to disable the toolbar button. But need to call the method Handle_toolbar method one more time.

former_member214498
Contributor
0 Kudos

Hi Adrian

There can be a way around for this problem. Once the user pushes the button you added in toolbar, it sets a flag say in Tvarv.

You set this condition in your code that if the flag is checked, button should not be visible. So the flow would be like this: Screen 100 is loaded and flag is initial so button is displayed but when the user comes back from the screen 200, flag will be checked and IF condition will not be fulfilled so this button will not be visible.

Regards

Waz

0 Kudos

Thanks guys for your replies.

I did code these ideas prior to posting the question, but was missing a trigger to refresh the display as it simply wouldn't go into my Form after pushing the Screen 200 BACK button. So the missing link was the following which I now added to the BACK button code:

*...

WHEN 'BACK' OR 'EXIT'.

PERFORM FREE_OBJECTS_0200.

PERFORM FM_REFRESH_TABLE_DISPLAY USING GRID. " refresh output table <---

LEAVE TO SCREEN 0.

*...

&----


*& Form FM_REFRESH_TABLE_DISPLAY

&----


FORM FM_REFRESH_TABLE_DISPLAY USING GRID TYPE REF TO CL_GUI_ALV_GRID.

DATA LS_STABLE TYPE LVC_S_STBL.

LS_STABLE-COL = 'X'.

LS_STABLE-ROW = 'X'.

CALL METHOD GRID->REFRESH_TABLE_DISPLAY

EXPORTING

IS_STABLE = LS_STABLE

EXCEPTIONS

FINISHED = 1

OTHERS = 2.

ENDFORM. " FM_REFRESH_TABLE_DISPLAY

*