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: 

Search a table without caring about lower and upper case

Former Member
0 Kudos

Hi to all!

I have a table with a field which differentiates lower and upper case. I want to search through this field without that distinction. Is there anyway to achieve this?

I'm also using ranges to allow * and + searches.

Thank a lot in advance!

8 REPLIES 8

Former Member
0 Kudos

Something like:


loop at itab.
  translate itab-field to upper case.
  if itab-field in range_tab.
* process
  endif.
endloop.

Rob

0 Kudos

Ok, that works but it is a little inefficient to me because my table contains about 5000 rows. Is there a better way??

Thanks a lot!!

0 Kudos

Hi,

May be this way.


loop at itab.
  translate itab-field to upper case.
  append itab1.
endloop.

sort itab1 by field.
delete adjacent duplicates from itab1 comparing field.
if not itab1[] is initial.
select * from your_table 
   for all entries in itab1
       where field = itab1-field
endif.

0 Kudos

Well, 5000 rows is not big.

But do you mean something like:

loop at itab where ( translate field ) to upper ) in range.

endloop.

Rob

0 Kudos

Yes, I mean something like that!

0 Kudos

Not that I'm aware of.

Rob

0 Kudos

Ok.. I got a workaround!!

/people/sap.user72/blog/2005/01/05/simple-fast-and-useful-sap-search-engine

in that code I found:

EXEC SQL PERFORMING loop_output3.

SELECT FUNCNAME, STEXT INTO :FIELD1, :FIELD2 FROM TFTIT

WHERE SPRAS = :'E' AND

FUNCNAME LIKE :MAINTEXT2 AND

UPPER( STEXT ) LIKE :F1 AND

UPPER( STEXT ) LIKE :F2 AND

UPPER( STEXT ) LIKE :F3 AND

UPPER( STEXT ) LIKE :F4 AND

UPPER( STEXT ) LIKE :F5 AND

UPPER( STEXT ) LIKE :F6 AND

UPPER( STEXT ) LIKE :F7 AND

UPPER( STEXT ) LIKE :F8 AND

UPPER( STEXT ) LIKE :F9 AND

UPPER( STEXT ) LIKE :F10

ENDEXEC.

0 Kudos

Sorry - I thought you meant an internal table. It's easy to do using native SQL on a database table.

Rob