cancel
Showing results for 
Search instead for 
Did you mean: 

Change Label text at runtime (WebDynpro)

Former Member
0 Kudos

Hey,

I just want to change the text property of a label or a textview at runtime.

Sadly I couldn't apply the solutions I found on my problem somehow.

I got a button which triggers an "onAction"-Event. There I want to change the text of my label.

A promising option was this post

When I used the code:

data lr_lbl type ref to  cl_wd_label.

lr_lbl ?= view->get_element( 'LABEL1' ).          "label1 is the ID of the label UI element

LR_LBL->SET_TEXT( 'New Text' ).

I got the error that "REF TO" could only be followed by "a class", "a interface" or "DATA".

"cl_wd_label" is a class and there's nothing else following what can cause an error I think.

Does anybody got an idea or just knows how to simply change the text-property of a label at runtime?


Thank you!

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

Instead create one attribute and bind it to text property of that label & set the attribute value as per your requirement.

Thanks

KH

Former Member
0 Kudos

Ok thanks. And how can I change the attribute value at runtime?

Former Member
0 Kudos

Hi,

Attaching the document for your reference which has snapshots. Hope this will help you.

Thanks

KH

Answers (1)

Answers (1)

Former Member
0 Kudos
Former Member
0 Kudos

Hmm Good. Just want to know are you from Germany?