Application Development and Automation 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: 
Read only

case sensitive statement in the select-statement

Former Member
0 Likes
2,607

Hi All,

i have a table in the abap-dictionary filled with names...when i try to select them with the select-statement with condition:

table-name_column like 'some_name'

I have encountered some problems...the inquiry is case-sensitive. What i want to do is to read the value from the abap-dictionary table uppercase or lowercase and compare it with the needed value also translated in uppercase or lowercase.

The only idea i have is to select all values of the dictionary table into an internal table and to translate the values there in uppercase or lowercase and then to loop trough it. But this approach would cost a lot of performance.

Do someone has an other proposal?

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,580

Hello Anton,

Your solution is one; there is another one which SAP frequently uses when facing this problem. Define another field in the table of the same length as the one which is case-sensitive but this field will hold the value in uppercase. You can than use this field (perhaps even defining an index for performance reasons) for your selections.

Regards,

John.

4 REPLIES 4
Read only

Former Member
0 Likes
1,581

Hello Anton,

Your solution is one; there is another one which SAP frequently uses when facing this problem. Define another field in the table of the same length as the one which is case-sensitive but this field will hold the value in uppercase. You can than use this field (perhaps even defining an index for performance reasons) for your selections.

Regards,

John.

Read only

Former Member
0 Likes
1,580

check...

It would be difficult , because it is based on how data is stored in the data base , now consider the scenario of the system i am using , we can material description as 'test' or 'TEST' , 'Test' .

If in your system there are only stored in either caps or small the you can perform the select twice .

But i myself dont find it to be such a good solution , but you can give it a try

There is one more solution specific to material description ,and that is in the table MAKT there is a field MAKTG , which stored the description in uppercase , so for this you can first convert the description to uppercase and then perform select on this field

Read only

sreeramkumar_madisetty
Active Contributor
0 Likes
1,580

Hi

In the selection-screen design itself.

Selection-screen : field type table-fieldname lower-case/upper case.

u can get the required case data only.

Regards,

kumar

Read only

Former Member
0 Likes
1,580

If the field will be selected against in many times multiple applications, then use the suggestion of creating an uppercase field and translate it everytime the case sensitive field changes.

However, if this is for a single application, consider native SQL. Something like:


REPORT ztest NO STANDARD PAGE HEADING.

TABLES lfa1.

DATA: name LIKE lfa1-name1 VALUE 'YOUR NAME HERE'.

EXEC SQL.
  SELECT *
  INTO :LFA1
  FROM  LFA1
  WHERE UPPER(NAME1)  =  :NAME
ENDEXEC.

Rob