cancel
Showing results for 
Search instead for 
Did you mean: 

Dynamically change the Label properties

Former Member
0 Kudos

Hi All

I am doing some customization in the ESS T&E WDA applications. One of my requirement is to change the already existing label properties and I am trying to do it as enhancement in the post-exit method of wddomodifyview( ).

Here is the Code I use

DATA ui_element TYPE REF TO if_wd_view_element.

DATA lable TYPE STRING.

ui_element = view->get_element( id = 'LOCATION_LABEL' ).

till here it works fine. After this I face the problem.

ui_element->get_<prop>( ). -


> using get_text( ) gives error.

From the forum and examples I could only see that I can use the method "get_<prop>( )" and "set_<prop>( )". If I try to use get_text( ) I get an error. It would be great if any of you would let me know the properties I can access instead of <prop>.

Thanks,

Venkat

Edited by: Venkat on Apr 11, 2008 11:23 PM

Edited by: Venkat on Apr 11, 2008 11:24 PM

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi,

DATA: ro_label type ref to cl_wd_label,

lv_text type string.

ro_label = cl_wd_label=>new_label( id = lv_label_id ).

if lv_text is not initial.

ro_label->set_text( lv_text ).

ENDIF.

Former Member
0 Kudos

Hi Alex/Sridevi

Thank you guys for your response. Actually the label I am trying to change is in the SAP provided WDA program for ESS T&E as enhancement. The labels in this particular views are retrieved from the "Short Description" of the components (LOCATION - for instance) of the defined structure by some program. Using the above code set_text ( ) sets the "vl_text" value which does not used at all. This is the reason the label is not getting changed. If you guys could give me some suggestions that would be great.

Thanks, Raj

Former Member
0 Kudos

Any suggestion folks?

Former Member
0 Kudos

hi venkat.....

you can either bind the text attribute to a type string nd then pass value to it or use the method set_text in the class cl_wd_label to set the value. you can also use get_text to first get the value, for testing purpose.

---regards,

alex b justin

Former Member
0 Kudos

Hi Alex

Thanks for your reply. I am trying to use get_text( ) just to test and once successful I would be using set_text( ) of the class cl_wd_label. But it gives error. Could you please pass me on some sample code for manupulating label properties.

Thanks, Venkat

Former Member
0 Kudos

Hi

I used the following code now, though it gets the text, but using the set_text( 'test') does not do any thing.

DATA label TYPE REF TO cl_wd_label.

label ?= view->get_element( 'LOCATION_LABEL' ).

label_text = label->get_text( ). -


> it gets the text "Location" successfully

label->set_text( 'test' ). -


> but this seems not working

The program gets executed successfully, but the text does not gets changed.

Am I missing something?

Thanks, Venkat

Former Member
0 Kudos

hi venkat.......

this is the coding :


data:

    obj type ref to cl_wd_label,
    value type string.


obj ?= view->get_element('LABEL').
value = obj->get_text( ).

obj->set_text('Jesus').

i think the value is getting replaced somewhere else.

its working fine.

---regards,

alex b justin