Skip to Content
author's profile photo Former Member
Former Member

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

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

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Jul 20, 2011 at 02:53 PM

    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.

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jul 20, 2011 at 02:56 PM

    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

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      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

      *

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.