Skip to Content
avatar image
Former Member

Activating/deactivating buttons at runtime


I need to activate/deactivate buttons at runtime in method WDDOMODIFYVIEW.

I have tried the following:


lr_button TYPE REF TO cl_wd_button.

lr_button ?= view->get_element( id = 'APPROVE' ).

lr_button->set_enabled( value = abap_false ).

I get the following error message: "Dynamic type conflict when assigning references"



Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Mar 09, 2009 at 01:51 PM

    First I strongly recommend that you not use coding in the WDDOMODIFYVIEW to control the enabled flag of such a UI element. Instead just data bind the enabled property to a context attibute and change the value of the context attribute to control the button state. This is the suggested way. WDDOMODIFYVIEW should only be used as a last resort to manipulate totally dynamically generated UIs. Otherwise design time binding should always be used.

    Your specific error would seem to be coming becuase the UI element with the ID APPROVE isn't being returned as a button, I would guess. That would explain the type conflict. Make sure that APPROVE really is the button's ID and that you haven't accidentally chosen a different UI element. In order to debug you could declare lr_button as type ref to CL_WD_UIELEMENT. This is the generic super class and should avoid the type conflict. From the debugger you can see the sepecif class type that was passed back by GET_ELEMENT.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Mar 09, 2009 at 01:51 PM

    Hi Morten,

    Can you check in debug mode the exact line of code causing error ? to me it seems that its happening not in the line of code you pasted above.



    Add comment
    10|10000 characters needed characters exceeded