cancel
Showing results for 
Search instead for 
Did you mean: 

change property of a field in a bound attribute

former_member305388
Active Contributor
0 Kudos

Hi Experts,

I am on SRM 7.0 and in one of the standard webdynpro screen we have done a customization to disable a field in the screen and make it invisible. The enhancement was done through the standard BADI WD_BADI_DOMODIFYVIEW.

The question is not specific to SRM but more to WebDynpro. There are two input field: preferred supplier and supplier. The existing change was to disable the field preferred supplier but now after the upgrade there is a binding created for both the fields and both have been assigned to same attribute in the context element. Due to this the existing code causes both the fields to be disabled in the webdynpro screen.

Is there anyway i can set the property of only single field in the attribute without affecting the other?

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

You can control the behavior of the UI Element by getting the right ui element object from the view.

all the Ui element classes provides getter and setter methods for the UI property. Try to do a post_exit enhancement for the wddomodify view.

Former Member
0 Kudos

Yes , try writing an exit(Post exit) method to WDDOMODIFYVIEW hook method.

It will work.

Please let me know if you want anything more.

Regards,

Praveen Kambala.

former_member305388
Active Contributor
0 Kudos

HI Baskaran,

In the existing functionality the class if_wd_component is being used to change the ui element property but now two elements have been binded to one context which is causing both the elements property to change when if_wd_component~set_enabled method is being used. Is there any other method that can be used to set the property of particular ui element of the context?

Praveen, thanks for the info, my current changes are in post exit only. I am looking for the right method to use to set the ui element property for bound context

My issue is similar to this thread:

Former Member
0 Kudos

The other method is already suggested. What happens here is that ui element property is controlled by the binding of the context attribute. When the attribute is binded to more than one UI element property and you want to have different behavior for each UI element then the options are

a) bind a new attribute to the UI element and control the behavior by setting the values to the context

b) directly manipulate the UI property as suggested by my earlier post

by the way, if_wd_component~set_enabled does not have such method. You probably meaning that the code call a component controller method.

former_member305388
Active Contributor
0 Kudos

Sorry for the confusion I was referring to the class CL_WD_UIELEMENT method set_enabled.

For modifying the UI property directly can you please provide some code snippet which I can use and understand, thanks.

Former Member
0 Kudos

hi,

i would do something like this. You need to replace the id of the ui element .

data: lo_ui_elem  type ref to cl_wd_uielement.

    lo_ui_elem ?= view->get_element( 'ID_OF_THE_UI_ ELEMENT' ).
    lo_ui_elem->set_visible( lo_ui_elem->e_visibility-none ).

saravanan_narayanan
Active Contributor
0 Kudos

Hello Srinivas,

If you want to disable the field then you have to call the CL_WD_UIELEMENT->SET_ENABLED( ABAP_FALSE ) method.

BR, Saravanan

former_member305388
Active Contributor
0 Kudos

Hi Baskaran/Saara,

Your code works well but it only hides the field, when I use CL_WD_UIELEMENT->SET_ENABLED( ABAP_FALSE ) method both the ui element get disabled. I want to disable only one ui element in this case.

saravanan_narayanan
Active Contributor
0 Kudos

Hello Srinivas,

for the other UI element set_enabled as abap_true. this should enable the second field.

BR, SAravanan

former_member305388
Active Contributor
0 Kudos

Hi Saara,

My customization is restricted to only disabling one ui element, the ui element is determined during runtime from a configuration table as which should be disabled, I was hoping for a solution which can be used to disable only the required ui element else I would need to hardcore the effected ui element which is not desirable.

saravanan_narayanan
Active Contributor
0 Kudos

Hello Sinivas,

Since both the fields in the UI are disabled because they are bound to same context attribute. the options left for you is to reset the value of this context attribute to ABAP_TRUE and disable the required fields by calling SET_ENABLED method.

BR, Saravanan