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

Button click?

Hi,

How can I see on what button is clicked on my VIEW?

I have 2 buttons on my view, HIDE and SHOW. When HIDE is clicked I hide table and when SHOW is clicked I show the table.

I use method WDDOMODIFYVIEW .

tnx, Adibo.

Add a comment
10|10000 characters needed characters exceeded

Related questions

5 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Jan 04, 2008 at 11:11 AM

    Hi Adibo,

    Since you already have two buttons, simply create two action handlers and then in action handler for HIDE, write code for hiding the table and in action handler for SHOW, write code for show.

    Simple 😊

    Regards,

    Neha

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 04, 2008 at 11:34 AM

    hi Adibo A ,

    First thing don't use WDONMODIFYVIEW because it will be called every time some change will occur in view .

    Solution : If you will see button properties you will find ON ACTION write some method lets say On_hide_click .

    Now write code to may that table invisible in this method ( Simply set visible property false ) .

    In similar way write code to make in visible in another method and call it on action of SHOW button

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi Adibo,

      If you are using the class cl_wd_table to manupulate the propery of the table, then you can do that in the modify view only, since its the only method where we can get a focus to the UI Elements,

      If you are using the an attribute to manage the visible property of table then you can write code directly on the onaction event of each button.

      Regards

      Sarath

  • author's profile photo Former Member
    Former Member
    Posted on Jan 04, 2008 at 10:42 AM

    Hi Adibo A ,

    For doing the table hiding at modify view you have to identify which button is clicked, so create an attribute (eg: button_name), then on the event trigger method of each button you have to set this attribute, like if u press hide set the value of button_name to hide and show for other. then at modify view you can read the attribute button_name and can identify which button is clicked. so you can write condition based on the value of attribute button_name and can hide the table accordingly.

    Another alternative for your requirement is like you can create an attribute of type boolean and bind this to the visible property of the table, then you can change the value of the attribute on the event of each button to false or true and the visibility of the table will change accordingly.

    Regards ,

    Sarath

    Reward points if it helps you

    Edited by: Sarath Satheesan on Jan 4, 2008 11:45 AM

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Hi Adibo,

      One thing you can do is , check the parameters in the modify view, some parameter in the itab will tell you which UI element trigger the latest event . you Can make use of that also for your requirement.

      Regards

      Sarath

  • author's profile photo Former Member
    Former Member
    Posted on Jan 04, 2008 at 10:59 AM

    Hi Adibo,

    In the event handler of the button action you have the parameter WDEVENT.

    Check out in debug mode

    wdevent → parameters:

    This internal table contains additional information about the UI element that

    fired the event. Store this value in an attribute, so that you can reuse it.

    Sankar.

    Editing

    -


    The ID of the UI element that fired the event is always contained in the

    table. As I said you can store it in an attribute. You can access this in WDDOMODIFYVIEW. Check which button is clicked and do the necessary code to hide or show the table UI element.

    It is highly advisable to do all the UI modifications in the method WDDOMODIFYVIEW.

    Edited by: Sankar R on Jan 4, 2008 12:15 PM

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 07, 2008 at 02:49 PM

    I created an ATTRIBUTE and I binded visible property of TABLE with this ATRIBUTE.

    Then OnAction of BUTTONS i created next code.

    method ONACTIONHIDE .

    DATA lo_el_context TYPE REF TO if_wd_context_element.

    • get element via lead selection

    lo_el_context = wd_context->get_element( ).

    • set single attribute

    lo_el_context->set_attribute(

    EXPORTING

    value = '01'

    name = `ATR_VISIBLE` ).

    endmethod.

    method ONACTIONSHOW .

    DATA lo_el_context TYPE REF TO if_wd_context_element.

    • get element via lead selection

    lo_el_context = wd_context->get_element( ).

    • set single attribute

    lo_el_context->set_attribute(

    EXPORTING

    value = '02'

    name = `ATR_VISIBLE` ).

    endmethod.

    Add a comment
    10|10000 characters needed characters exceeded

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.