cancel
Showing results for 
Search instead for 
Did you mean: 

Change binding of an element in standard WD Component via enhancement

preethi_santhanam
Participant
0 Kudos

Hi,

I have a requirement to make some ( say 4 out of 10 ) fields of a standard web dynpro view to read only, based on a condition. All these 10 fields are bound to an attribute already to control their read-only status.

Using enhancements, I have created a new attribute which could be bound to the read-only property of these 4 fields. The binding can however not be changed via enhancements. The only other option I see is to create an enhancement view, but will this enhancement view replace the original view? Is there nay other simple solution to this?

The WD Component I'm trying to work on is FMCA_WDY_FPF_REG, and VIEW_OVERVIEW view. You may have a look at it if you would have access to it.

Best Regards,

Preethi.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

You can do a enhancement (Deleting the exiting UI elements and create them again same ids and bind the read_only property).

You can also do a post exit change in wddomodifyview, get the respective UI elements object from the view and uses the method to bind the custom context attribute to the readonly property.

preethi_santhanam
Participant
0 Kudos

Hi Baskaran,

Thanks so much for yorur eply. I have solved it myself by simply adding a post exit to modify view method, and no new context attribute.

I've used teh code

DATA: lo_ui_elem TYPE REF TO cl_wd_uielement.

lo_ui_elem ?= view->get_element( 'UI_ELEMENT' ).

CALL METHOD lo_ui_elem->set_enabled

EXPORTING

value = abap_false.

Thanks & Regards,

Preethi.

RicardoRomero_1
Active Contributor
0 Kudos

Hi !

with your solution the field is displayed in gray.

If you want to set as Read-Only you can do the following:

Create a node in the context called for example ZZ_VISUALIZATION.

Create within this node an attribute called ZZ_READ_ONLY, put if you want the default value set to X.

Put the following code in the method WDDOMODIFYVIEW:

DATA: lo_ui_elem TYPE REF TO cl_wd_input_field.

  lo_ui_elem ?= view->get_element( 'YOUR_UI_ELEMENT' ).

 CALL METHOD lo_ui_elem->bind_read_only
   EXPORTING
     path   = 'ZZ_VISUALIZATION.ZZ_READ_ONLY'.

warning !!! : the var lo_ui_elem is declared as cl_wd_input_field, change it by the correct type... you can find it in se24 searching for cl_wd*

hope this help you...

Regards.

Answers (0)