cancel
Showing results for 
Search instead for 
Did you mean: 

Reading Label Text

Former Member
0 Kudos

Hi,

I need to read a label text to pass as an argument to the Message Pool in my DC.

The Text for this label is being displayed from ABAP.

So when I use the following code, the argument passed is displayed as null (as I havent set any text value for this Label) on the view.

oStrtDateAft = (IWDLabel) view.getElement("ProjStartAfterLabel");

manager.reportMessage(IMessageMainComp.ERROR__NULL__STARTDATEAFT, new Object[] {oStrtDateAft.getText()}, false);

Is there any option to read the value of the label text that is read from ABAP?

Accepted Solutions (1)

Accepted Solutions (1)

sridhar_k2
Active Contributor
0 Kudos

Hi Shika,

It is working for me.

IWDLabel label = (IWDLabel)view.getElement("Label");

String text = label.getText();

manager1.reportSuccess("Txt "+as);

manager1.reportMessage(IMessageTestWDComp.START,new Object [],true);

Regards,

Sridhar

Former Member
0 Kudos

Hi Sridhar,

Have you explicitly set the Text property of the Label? If so, it would work fine, but I haven set it, as it reads the label from ABAP.

Please let me know if you have not set the text property of Label and if it still works...

Thanks for the reply..

Shradha

sridhar_k2
Active Contributor
0 Kudos

Hi,

Yes. I assigned it explicitly.

If all the labels are coming from the backend,why don't you get it from Model directly.

Regards,

Sridhar

Former Member
0 Kudos

Hi,

Yes I would like to read it from the Model directly, how do i do that?

Thanks!

Former Member
0 Kudos

Hi ,

size = wdContext.node<outputlabelnode>.size();

for (int idx = 0; idx < size; idx++) {

IPrivate<ApplicationView>.I<outputlableElement> val =(IPrivate<ApplicationView>.I<outputlableElement>) wdContext.nodeI<outputlabelnode>().getElementAt(idx);

String sval = val.NAMEOFATTRIBUTE;

It might helps .

Thanks

Lohi

Former Member
0 Kudos

Hi,

val.NAMEOFATTRIBUTE does not work.

Thanks for suggestions!

Former Member
0 Kudos

Shikha,

Use this:

wdContext.node<<i>NodeName</i>>.getNodeInfo().getAttribute("<i><AttributeName></i>").
                 getModifiableSimpleType().getFieldLabel();

Bala

Former Member
0 Kudos

It works great, thanks a lot Bala!

Answers (0)