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 text

Former Member
0 Likes
3,002

Hi experts,

I have a below written query:

IF customer_name IS NOT INITIAL.

SELECT SINGLE kunnr FROM kna1 INTO lv_kunnr

WHERE

name1 = customer_name.

ENDIF.

The issue is that some of the 'name1" in KNA1 are in lower case, so what happens is that the FM in which I am coding, by default searches for the upper case fields. Since it does not find it, the output is not as desired.

How to rectify this issue?

Thanks,

Ajay.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
2,547

Hi,

Use the FM AIPC_CONVERT_TO_UPPERCASE

to convert the customer_name to uppercase.

First pass the customer_name to Fm AIPC_CONVERT_TO_UPPERCASE.

After changing the value to upper case use the same in sql to get your desired results.

Edited by: Sudha Rani Pathuri on Dec 16, 2009 6:30 PM

12 REPLIES 12
Read only

Former Member
0 Likes
2,548

Hi,

Use the FM AIPC_CONVERT_TO_UPPERCASE

to convert the customer_name to uppercase.

First pass the customer_name to Fm AIPC_CONVERT_TO_UPPERCASE.

After changing the value to upper case use the same in sql to get your desired results.

Edited by: Sudha Rani Pathuri on Dec 16, 2009 6:30 PM

Read only

Subhankar
Active Contributor
0 Likes
2,547

Hi Ajay,

Just declare the variable customer_name as TYPE NAME1_GP.

It will solve your problem.

Thanks

Subhankar

Read only

awin_prabhu
Active Contributor
0 Likes
2,547

Hi Ajay,

Get the dynamic combination of Name1 from parameters. In Parameters use LOWER CASE option.


Report Ztest.
Parameters: pattern type string LOWER CASE. " Lower case makes the Name1 as Case sensitive.
CALL FUNCTION 'ZTESTSERCH'  " Call ur function module
IMPORTING
pattern = pattern.                        " Pass Name1 to FM

Inside FM code like below,


CONCATENATE '%' pattern '%' INTO pattern.
IF NOT i_name1 IS INITIAL.
SELECT kunnr
FROM kna1
INTO TABLE it_kna1
WHERE name1 like pattern.
ENDIF.

Thanks

Read only

Former Member
0 Likes
2,547

Hi,

Use MCOD1 Field instead of NAME1..

MCOD1 Stores the same Value stored in NAME1 in upper Case.

IF customer_name IS NOT INITIAL.
  TRANSLATE customer_name to UPPER CASE.
   SELECT SINGLE kunnr FROM kna1 INTO lv_kunnr
            WHERE MCOD1 = customer_name.
ENDIF.

Read only

Former Member
0 Likes
2,547

Hi Ajay,

First you have to select all the records from KNA1 table to and internal table say IT_KNA1.

Then you loop through that internal table IT_KNA1 and TRANSLATE each NAME1 to UPPERCASE.

After the entire loop process you read the table IT_KNA1 with the key NAME1 = CUSTOMER_NAME.

Hope this will solve your issue.

Regards,

Smart Varghese

Read only

kesavadas_thekkillath
Active Contributor
0 Likes
2,547

The data element for NAME1 is NAME1_GP.

The domain is NAME for which lowe case is marked.

So the name gets always stored in lower case.

So convert your input into lower case and then pass to the query.

Read only

0 Likes
2,547

>

> The domain is NAME for which lowe case is marked.

> So the name gets always stored in lower case.

Is it ? So for domains with "lower case" marked, you cannot store Upper case data ?

Suhas

Read only

0 Likes
2,547

Suhas is right.

If Domain is marked as 'LOWER CASE', then the value entered is considered as Case sensitive.

Both Upper case and Lower case data can be stored in the table.

Thanks,

Read only

0 Likes
2,547

I dont think so Suhas ...

I read the doc ... Sorry yar i'm wrong

Edited by: ksd on Dec 16, 2009 7:52 PM

Read only

0 Likes
2,547

Createad a FM with the below code. Used Name as import parameter with

data element text30 (domain text30). Text30 is marked with lowercase indicator at the domain level.

*"----


""Local Interface:

*" IMPORTING

*" VALUE(NAME) TYPE TEXT30

*"----


DATA : lv_kunnr type kunnr.

SELECT SINGLE kunnr FROM kna1 INTO lv_kunnr

WHERE name1 = NAME.

Executed the FM in SE37 and passed value 'TeSt' it converts name mixedcase into uppercase and it does not work as expected

Created a program with the below code. Executed the program and entered the value 'TeSt' and it does not

convert to Uppercase in the FM.

*****************************

PARAMETERS : p_test type text30.

CALL FUNCTION 'YTEST_K'

EXPORTING

name = p_test

.

If sy-subrc eq 0.

endif.

******************************

Regards,

LK.

Read only

Former Member
0 Likes
2,547

Why does everyone always look for the most difficult solution??

Rob

Read only

Former Member
0 Likes
2,547

So, you don't want to use the field that was meant for this - KNA1-MCOD1?

Rob