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

Disabling button

Hi,

How can i disable button when i click on that button. That means first time it should be enable. When i click on that button it should be disable. How can i do that one.. help me

Add a comment
10|10000 characters needed characters exceeded

Related questions

3 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Jan 29, 2008 at 08:42 AM

    Hi Shyja ,

    First we should create attribute(ENABLE) with data type as WDY_BOOLEAN , then bind that attribute to button's Enable property,After that go to WDDOINIT() method in View , Write the following code,

    DATA:

    elem_context TYPE REF TO if_wd_context_element,

    stru_context TYPE if_v_main=>element_context ,

    item_enable LIKE stru_context-enable.

    • get element via lead selection

    elem_context = wd_context->get_element( ).

    • get single attribute

  • elem_context->get_attribute(

  • EXPORTING

  • name = `ENABLE`

  • IMPORTING

  • value = item_enable ).

  • CALL METHOD elem_context->set_attribute

    EXPORTING

    VALUE = 'X'

    name = `ENABLE` " Attribute Name

    .

    After that we should create one event for that button ,

    then we should write below code for that event method,

    DATA:

    elem_context TYPE REF TO if_wd_context_element,

    stru_context TYPE if_v_main=>element_context ,

    item_enable LIKE stru_context-enable.

    • get element via lead selection

    elem_context = wd_context->get_element( ).

    • get single attribute

  • elem_context->get_attribute(

  • EXPORTING

  • name = `ENABLE`

  • IMPORTING

  • value = item_enable ).

  • CALL METHOD elem_context->set_attribute

    EXPORTING

    VALUE = ' '

    name = `ENABLE` " Attribute Name

    .

    Regards,

    Vijay

Add a comment
10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 29, 2008 at 09:14 AM

    Shyja,

    could you please stop reposting your question? It is already answered in each of your 3 threads.

    Thank you,

    Sascha

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jan 29, 2008 at 09:16 AM

    Hi ,

    In WDDOMODIFY view

    try the following:

    DATA : obj_btn TYPE REF TO cl_wd_button.

    obj_btn ?= view->get_element( 'button' ).

    if ( first_time == abap_false ).

    CALL METHOD obj_btn->set_enabled(

    EXPORTING

    value = abap_false ).

    endif.

    Thanks,

    madhu

    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.