‎2009 Dec 16 12:50 PM
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.
‎2009 Dec 16 12:56 PM
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
‎2009 Dec 16 12:56 PM
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
‎2009 Dec 16 1:05 PM
Hi Ajay,
Just declare the variable customer_name as TYPE NAME1_GP.
It will solve your problem.
Thanks
Subhankar
‎2009 Dec 16 1:08 PM
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
‎2009 Dec 16 1:11 PM
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.
‎2009 Dec 16 1:11 PM
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
‎2009 Dec 16 1:44 PM
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.
‎2009 Dec 16 1:46 PM
>
> 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
‎2009 Dec 16 1:52 PM
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,
‎2009 Dec 16 2:20 PM
I dont think so Suhas ...
I read the doc ... Sorry yar i'm wrong
Edited by: ksd on Dec 16, 2009 7:52 PM
‎2009 Dec 17 9:23 AM
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.
‎2009 Dec 16 2:14 PM
Why does everyone always look for the most difficult solution??
Rob
‎2009 Dec 17 2:19 PM
So, you don't want to use the field that was meant for this - KNA1-MCOD1?
Rob