Skip to Content

Custom button: enable and visibility

Dear experts,

I'm working on an enhancement on an ABAP Web Dynpro.

I created a Button element and bound the attributes "ENABLE" and "VISIBLE" to the same Context attribute, which is called "DISPLAY_MODE".

In WDDOMODIFYVIEW I basically check if the user is in DISPLAY or in EDIT mode; if in DISPLAY mode, then DISPLAY_MODE attribute in the context is set to 'X'.

What I'd like to have:

  • in DISPLAY mode, the user should be able to see and press the button;
  • in EDIT mode, the buttons shouldn't be visible anymore.

Unfortunately, it doesn't work. The visibility binding works like a charm, while the enable one doesn't work as even if in DISPLAY mode, the button remains disabled (it turns grey).

I tried then to force the attribute in WDDOMODIFYVIEW as follows:

DATA: btn_elem    TYPE REF TO IF_WD_VIEW_ELEMENT,

             cust_button TYPE REF TO CL_WD_BUTTON.

       CALL METHOD VIEW->GET_ELEMENT

         EXPORTING

           ID      = 'PURCHGRP_EDIT'

         RECEIVING

           ELEMENT = btn_elem

           .

       cust_button ?= btn_elem.

       CALL METHOD cust_button->SET_ENABLED

         EXPORTING

           VALUE  = abap_true

           .

but again, that doesn't work as in DISPLAY mode, the field remains disabled.

Any suggestion on the task? Please help me finding a workaround 😉

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Best Answer
    Mar 22, 2013 at 02:22 PM

    Hi,

    In edit mode you don't want button and in display mode you need button. So i don't think you need to bind the enable property also. jus remove the enable property binding and make it visible in display mode and hide it in edit mode.

    Also its should work if you bind the enable property also, may be something you have done wrong. jus check once again.

    Regards,

    Kiran

    Add comment
    10|10000 characters needed characters exceeded

    • Yep my friend, there was something missing... I did once again the bindings and tried to manage via code in WDDOMODIFYVIEW some specific cases and gladly, it worked 😉

      Thanks again!