cancel
Showing results for 
Search instead for 
Did you mean: 

how to cast a fieldinput value to upper case.

Rodrigo-Giner
Active Contributor
0 Kudos

Im not a java programer I guess that this must be a silly thing.

Im searching data in R/3 from 2 fields 1 numeric and the other alphanumeric. This alphanumeric fields if I put it in upper case works, if I wirte it in lower case doesnt works.

In R/3 when I test the FM doesnt matter if I put it lower or upper case, it works fine.

so I wanna know how can I in WD cast the value that I put in that fieldinput be converted to upper case when I hit the search button.

Thx

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi

You assign the context attribute of type String to this inputField say Value.

On the code of the action of your button you get wdContext.currentContextElement().getValue().toUpperCase() and set this value to the input parameter of your FM.

Regards,

Ajay

Answers (2)

Answers (2)

Former Member
0 Kudos

> Im not a java programer I guess that this must be a

> silly thing.

>

> Im searching data in R/3 from 2 fields 1 numeric and

> the other alphanumeric. This alphanumeric fields if I

> put it in upper case works, if I wirte it in lower

> case doesnt works.

>

> In R/3 when I test the FM doesnt matter if I put it

> lower or upper case, it works fine.

>

> so I wanna know how can I in WD cast the value that I

> put in that fieldinput be converted to upper case

> when I hit the search button.

>

> Thx

Hi,

When you test the FM in SE37 in R3 there is an option at the top of the screen Called Uppercase/Lowercase - this controls whether the input is automatically converted to upper case for alphanumeric fields.

The other option you have, if it is a custom FM, is to translate the input of the alphanumeric fields in the ABAP - it is quite common to have to translate or convert input data to make sure it is in the same format as the backend system.

I prefer to do this sort of conversion on the backend system as usually you have a better guarentee that it will be in the correct format, than if you do it in the Java element.

Just my opinion,

Gareth.

Former Member
0 Kudos

Before calling the remote function, you could change the attribute value in the context to uppercase. Say your InputField.value property is bound to an attribute named "Value", you could do something like


Locale locale = ... /* used locale */
String value = wdContext.currentContextElement().getValue();
wdContext.currentContextElement().setValue(value.toUpperCase(locale));

Armin