cancel
Showing results for 
Search instead for 
Did you mean: 

SET_ATTRIBUTE_PROPERTY

Former Member
0 Kudos

Hi,

can anyone tell me in which interface the set_attribute_property method is there....

my coding is

DATA:

ELEM_CONTEXT TYPE REF TO IF_WD_CONTEXT_ELEMENT,

STRU_CONTEXT TYPE IF_RADIO=>ELEMENT_CONTEXT ,

l_restrict TYPE wdy_boolean,

ITEM_TEXT LIKE STRU_CONTEXT-TEXT.

  • get element via lead selection

ELEM_CONTEXT = WD_CONTEXT->GET_ELEMENT( ).

  • get single attribute

ELEM_CONTEXT->GET_ATTRIBUTE(

EXPORTING

NAME = `TEXT`

IMPORTING

VALUE = ITEM_TEXT ).

CALL METHOD ELEM_CONTEXT->set_attribute_property

EXPORTING

attribute_name = 'TEXT'

property = ELEM_CONTEXT->e_property-read_only

value = 'X'.

Am getting error that set_attribute_property does not exist

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Ranjith,

set_attribute_property() this method u can find it in IF_WD_CONTEXT_ELEMENT interface of the UI Element.If u want to set the property of any UI Element dynamically (Eg: Read Only Property Of INPUT FIELD ),Just declare a attribute in the Context,bind that attribute to the property of the UI Element in the Layout( While Designing the View ). Set that attribute with the Property Values ( Eg: True or False ).

Thanks,

Naga Prakash

Edited by: Prakash Naga on Jan 10, 2011 11:04 AM

Answers (5)

Answers (5)

Former Member
0 Kudos

SET_ATTRIBUTE_PROPERTY property supports in newer versions... better way to control property is by binding one attribute to the field for visibility and control it during runtime.

gill367
Active Contributor
0 Kudos

Better approach to make the input field read only at the runtiem is by binding the read only property of the input field to some

context attribute and then modifying the value at teh runtime on the desired condition.

thanks

Sarbjeet singh

gill367
Active Contributor
0 Kudos

The code you have written is corect only. you may be getting the syntax error because of soem spelling worng.

please check and try to activate again.

thanks

Sarbjeet.

Former Member
0 Kudos

Hi Ranjith,

Its in the IF_wd_context_node interface.

Please send the attribute name , property name and value in the method call.

I hope it helps.

Regards,

Sumit

sahai
Contributor
0 Kudos

hi,

you got an error because the object ELEM_CONTEXT is of class IF_WD_CONTEXT_ELEMENT now if you check the class in se24

you can check the parameters which is required there fr you reference pls have a look at the sample code i am sharing here

CALL METHOD lo_el_demo->set_attribute_property

EXPORTING

attribute_name ='TABLE_FIELD'

property = 'VISIBLE'

value = abap_false.

but it is always the best to follow the below method when ever you are going to make a field enable and disable dynamically.

create one attibute of type WDY_BOOLEAN and bind this attribute to the visible property of the input fields.

for example

attibute name = 'visible ' : type = wdy_boolean :default value = X

onaction of the radio button place the following code.it really works

DATA lo_el_context TYPE REF TO if_wd_context_element.

DATA ls_context TYPE wd_this->element_context.

DATA lv_visible TYPE wd_this->element_context-visible.

DATA lo_nd_radio_node1 TYPE REF TO if_wd_context_node.

DATA lo_el_radio_node1 TYPE REF TO if_wd_context_element.

DATA lw_index TYPE i.

DATA lo_el_radio_node1_1 TYPE REF TO if_wd_context_element.

lo_nd_radio_node1 = wd_context->get_child_node( name = wd_this->wdctx_radio_node1 ).

lo_el_context = wd_context->get_element( ).

CALL METHOD lo_nd_radio_node1->get_lead_selection_index

RECEIVING

index = lw_index.

lo_el_radio_node1_1 = wd_context->get_element( ).

IF lw_index = 1.

lo_el_context->set_attribute(

name = `VISIBLE`

value = 'X' ).

ELSE.

lo_el_context->set_attribute(

name = `VISIBLE`

value = ' ' ).

ENDIF.

hope this may solve your problem

thanks and regards,

sahai.s