Upper case / Lower case

Development (ABAP Development WorkBench, ABAP/4 programming)

Moderators: Snowy, thx4allthefish, YuriT, Gothmog

Post Reply
hsenden
Posts: 167
Joined: Mon Oct 21, 2002 2:22 am
Location: Wijlre, Netherlands
Contact:

Upper case / Lower case

Post by hsenden » Tue Sep 13, 2005 2:28 am

Hi,

In a standard SAP table I have an entry field1 'Abcdef'. (domain has lower case checkbox checked).

In a new RFC the user must have the possibility to fill in 'AB*' or 'ab*' (so case insensitive), and the rfc must return the record with field 'Abcdef'.

Is there a way to make the select statement case insensitive on that field?

regards,
Hans
hans.senden@philips.com

Yorkie Abaper
Posts: 878
Joined: Wed Jan 22, 2003 2:57 am
Location: N 53° 38.817 W 001° 50.118

Post by Yorkie Abaper » Tue Sep 13, 2005 2:37 am

Sadly not, data stored in SAP tables is always case sensitive. Without doing something clever with native SQL, I'd recommend converting the inputted data to upper case before writing to the database.

That's why on some SAP tables (eg MAKT) you see two fields with the same data, however one is stored entirely in uppercase for matchcodes etc.

Yorkie
I think too much and I drink too much.

phillipm
Posts: 376
Joined: Fri Oct 25, 2002 3:54 am
Location: Lyon, France

Post by phillipm » Tue Sep 13, 2005 2:43 am

You need to use TRANSLATE TO LOWER/UPPER so you have both values identical. Best if you only need to translate the search term, obviously.
If you know that all values in your table are Abcde... and user may enter AB* then translate it first and feed it to SELECT statement.
If the field contents do not follow a standard then translate it in a SELECT.ENDSELECT.

Hope this helps...

pm

hsenden
Posts: 167
Joined: Mon Oct 21, 2002 2:22 am
Location: Wijlre, Netherlands
Contact:

Post by hsenden » Tue Sep 13, 2005 2:55 am

Yorkie Abaper wrote:Sadly not, data stored in SAP tables is always case sensitive. Without doing something clever with native SQL, I'd recommend converting the inputted data to upper case before writing to the database.
Yorkie
Unfortunately this is not possible. I have to search for the vendor's name (LFA1-NAME1). So i cannot write all vendor names first to upper case. In some case the user want to print the vendor's name in both upper/lower case.

I have found a field LFA1-MCOD1 (Search term for matchcode search) which contains the first 25 characters of LFA1-NAME1 (35 charachers) in upper case. With restrictions to the length i can use this field.

For the other text field for which the problems exists, country's name (T005T-LANDX), i can first read all countries into an internal table, translate them to upper case and do the search. There only 237 countries in our system, so this must not be such a performance problem.

regards,
Hans

hognoxious
Posts: 1398
Joined: Thu Dec 04, 2003 8:16 am
Location: Stuck in a pagoda with Tricia Toyoda

Post by hognoxious » Thu Sep 15, 2005 8:54 am

hsenden wrote: For the other text field for which the problems exists, country's name (T005T-LANDX), i can first read all countries into an internal table, translate them to upper case and do the search. There only 237 countries in our system, so this must not be such a performance problem.
You could do that (as you rightly say, it's quite a restrictred set), but for me it would be easier to search by the country code anyway. ES is shorter to type than Spain.
First he pinches my sig, Now he's cribbing my posts too!

nifelheimer
Posts: 101
Joined: Thu Mar 17, 2005 11:15 am

Post by nifelheimer » Thu Sep 15, 2005 9:07 am

ES is shorter to type than Spain
At least if you have learned the 237 country codes by heart. :roll:

hognoxious
Posts: 1398
Joined: Thu Dec 04, 2003 8:16 am
Location: Stuck in a pagoda with Tricia Toyoda

Post by hognoxious » Thu Sep 15, 2005 10:05 am

nifelheimer wrote:At least if you have learned the 237 country codes by heart. :roll:
I know all the ones that matter, with apologies to anyone from Kazakhstan, Chad or Vanuatu - I'm sure they're lovely places, really. :wink:
First he pinches my sig, Now he's cribbing my posts too!

Guest

Re: Upper case / Lower case

Post by Guest » Thu Sep 15, 2005 10:17 am

Use a case-insensitive select-option on LFA1-MCOD1.
This has the additional advantage that this field is part of a secondary index.

Post Reply