Skip to Content
avatar image
Former Member

Select in upper and lower case - Is it possible ?

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.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

5 Answers

  • Best Answer
    avatar image
    Former Member
    Jul 10, 2009 at 01: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

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jul 10, 2009 at 09: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

    Add comment
    10|10000 characters needed characters exceeded

  • Jul 10, 2009 at 09: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

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jul 10, 2009 at 11:03 AM

    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.

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Tks,

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

  • avatar image
    Former Member
    Jul 10, 2009 at 11:30 AM

    @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.

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      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