07-10-2009 10:49 AM
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.
07-10-2009 2:53 PM
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
07-10-2009 10:51 AM
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
07-10-2009 10:58 AM
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
07-10-2009 12:03 PM
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.
07-10-2009 12:15 PM
Tks,
but I dont know if the name is write like this 'roBerto'. or like this 'Roberto, or like this 'ROBERTO', etc etc
07-10-2009 12:30 PM
@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.
07-10-2009 12:46 PM
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.
07-10-2009 1:12 PM
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
07-10-2009 2:53 PM
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