Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Select in upper and lower case - Is it possible ?

Former Member
0 Kudos

Helle expert,

I have to make a select from BUT000 table. My selection's fields are NAME_LAST and NAME_FIRST.

My question is:

there's a command or an option that allow to select the row if the value is in upper case and also in lower case ?

I mean that I want to select if NAME_LAST is Roberto, or ROBERTO, or roberto.

any idea ?

tks.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Easy:

Instead of using NAME_LAST and NAME_FIRST in the SELECT, use the upper case translations that are used in the search helps: MC_NAME1 and MC_NAME2.

Always look for an upper case translation for fields like this before trying some sort of conversion in the SELECT.

Rob

Edited by: Rob Burbank on Jul 10, 2009 12:44 PM

8 REPLIES 8

Former Member
0 Kudos

hi,

You can select the data as it is there in the table using your select statement and then use TRANSLATE to either convert in upper or lower case ..

thanks

SuhaSaha
Advisor
Advisor
0 Kudos

I mean that I want to select if NAME_LAST is Roberto, or ROBERTO, or roberto

Hello,

If you check the domain for NAME_LAST & NAME_FIRST which is BU_NAME, the checkbox "Lowercase" is checked. Hence the SELECT will not perform in the way you want it to perform.

I think while SELECTing data from BUT000 for the fields without NAME_LAST & NAME_FIRST in the WHERE clause. Then LOOP the internal table & filter the data.


DATA:
BEGIN OF IT_BUT000 OCCURS 0,
NAME_LAST(40)  TYPE C,
NAME_FIRST(40) TYPE C,
END OF IT_BUT000.

SELECT * FROM BUT000 INTO TABLE IT_BUT000[]
WHERE <if you have any other fields w/o using NAME_LAST & NAME_FIRST >.

IF SY-SUBRC = 0.
LOOP AT IT_BUT000[].
IF IT_BUT000-NAME_LAST = 'rObErTo'.
*  Do your validation
ENDIF.
ENDLOOP.
ENDIF.

Hope i am clear.

BR,

Suhas

Former Member
0 Kudos

Yes there is an operator.

Operator CP compares pattern and it is case insensitive.

So use, fieldname CP 'RoBerTo' in your SELECT statement.

The comparison will be case insensitive.

0 Kudos

Tks,

but I dont know if the name is write like this 'roBerto'. or like this 'Roberto, or like this 'ROBERTO', etc etc

Former Member
0 Kudos

@Roberto

Since the comparison is case insensitive, you can write it any form you wish

fieldname CP 'roberto'

fieldname CP 'ROBERTO'

fieldname CP 'RobertO'

All the above expressions would behave in same way.

0 Kudos

not run....

CLEAR but000.

SELECT SINGLE * FROM but000

WHERE name_last cp p_nom

AND name_first cp p_prenom

AND birthdt = p_date_n.

error 'cp is not a valid comparison operator.

0 Kudos

Hi Roberto,

As Suhas mentioned, it is not possible.

For many of the fields like Material description (which can be lower and uppercase), SAP has provided seaparate field that stores the description in Uppercase only. You can search if there is a similar field for your selection.

Thanks,

Bikash

Former Member
0 Kudos

Easy:

Instead of using NAME_LAST and NAME_FIRST in the SELECT, use the upper case translations that are used in the search helps: MC_NAME1 and MC_NAME2.

Always look for an upper case translation for fields like this before trying some sort of conversion in the SELECT.

Rob

Edited by: Rob Burbank on Jul 10, 2009 12:44 PM