2006 Oct 03 10:16 AM
Hi,
I need small help on conversions.
I need to convert the data in database tables to lower case.
Like i need to pick some data from a database table. The data stored in the database table is in uppercase. Here i need to convert the data to lowercase through the select statement. Is there any way to do this.
Regards,
Ram
Hi,
I need small help on conversions.
I need to convert the data in database tables to lower case.
Like i need to pick some data from a database table. The data stored in the database table is in uppercase. Here i need to convert the data to lowercase through the select statement. Is there any way to do this.
Regards,
Ram
2006 Oct 03 10:18 AM
U can read the data from the table...convert to lower case and modify the table again.
TRANSLATE lchr TO LOWER CASE.
--> I hope you dont have to translate the key fields even in that case u would need to delete the record and insert.
Message was edited by: Anurag Bankley
2006 Oct 03 10:21 AM
Hi,
Before i execute the select statement i need the data to be converted to lowercase.
The thing is i can do the conversion after the select statement. Here i need to get some data from select statement and from the data we get here i need to write one more select statement which also to be displayed lowercase data.
Regards,
Ram
2006 Oct 03 10:24 AM
Hi,
just write 2 select statements in that case.
After the first select you modify the data in the
table then select the changed data.
2006 Oct 03 10:30 AM
Hi,
Here is my code..
SELECT addrnumber name1 city1 FROM adrc INTO TABLE i_adrc
WHERE name1 IN r_name1 AND city1 IN r_city1.
IF i_adrc IS NOT INITIAL.
SELECT kunnr adrnr brsch bran1 land1 INTO TABLE i_kna1
FROM kna1 FOR ALL ENTRIES IN i_adrc
WHERE adrnr = i_adrc-addrnumber AND
brsch IN r_brsch AND
bran1 IN r_braco AND
land1 IN r_land1.
Here after the first select statement i am not getting the required data as name1 is maintained in Uppercase in the database. SO i need to change the data to lowercase before the select statement itself.
regards,
Ram
2006 Oct 03 10:36 AM
I think the best way is to convert the data in your range r_name1 to uppercase and fetch the date from adrc table.
loop at r_name1.
translate r_name1-low to upper case.
translate r_name1-high to upper case.
modify r_name1.
endloop.
2006 Oct 03 10:44 AM
Hi,
It not peoblem with the ranges. The data in the database should be made nto lowercase before my select statement so that i will get all the data.
regards,
Ram
2006 Oct 03 10:55 AM
Is your problem that you need to convert the data in ADRC table into lower case OR fetching the data from ADRC ??
2006 Oct 03 10:59 AM
ADRC-Name1 data should be converted to lowercase and need to get the requred data based on the select statement.
Regards,
Ram
2006 Oct 03 11:01 AM
The only way is to do the below before your code...
<b>select name1 into lname1 from adrc.
translate lname1 to lower case.
adrc-name1 = lname1.
modify adrc.
endselect.</b>
Message was edited by: Anurag Bankley
2006 Oct 03 11:07 AM
HI Anurag,
select name1 from adrc.
translate adrc-name1 to lower case.
update adrc.
endselect.
The above statement is giving error as
"Field list without into clause is not allowed. Itab or into(f1....fn) is not allowed..Can you pls correct me.
Regards,
Ram
2006 Oct 03 11:08 AM
Hi,
As far as I understood, Ur problem is getting all the data be it lower case or uppercase in ADRC table for the range...
I think you can try...
Select <fields> from ADRC
where name1 LIKE <range field>.
Thanks,
Rashmi.
2006 Oct 03 11:31 AM
Hi Anurag,
Thanks for the reply.
But its taking much time to execute the select statement. Is there any other simple way of doing this.
Regards,
Ram
2006 Oct 03 11:34 AM
Actually it would as you want to update all the records in ADRC table...I am not sure why you wish to update all the database table records in lower case...you can easily fetch your data if you change the range to use upper case and manipulate the same in report when required.
To change the range check my earlier code and you would be able to get the data.
2006 Oct 03 11:49 AM
Hi ANurag,
Even after changing the range field as you said its giving the data which is in UPPER case for the name1 field. I need all the data for name1 with lower and upper case as well.
Regards,
Ram
2006 Oct 03 11:52 AM
Yes, it would give you in upper case but once you have fetched the data you can convert it into lower case using the TRANSLATE statement.
Second option is when you are updating ADRC do it for the required records only.
2006 Oct 03 12:03 PM
Hi Anurag,
My question is, I have both upper case and Lower case data in ADRC-name1 field. I am searching for some records with string 'good'. Once i execute the select statement its fetching only the Uppercase data. Here i need all the records with upper as well as lower case for 'good' as the string.
I am writing this in function mofdule and so it takes only uppercase search even if we give that in lower case.
Hope you understood my question.
Regards,
Ram
2006 Oct 03 12:14 PM
Hi Ram mohan,
Try by appending * at the begining and end of text like good , this will fetch the data in both the cases.
Hope this helps.
2006 Oct 03 12:14 PM
My question is, I have both upper case and Lower case data in ADRC-name1 field. I am searching for some records with string 'good'. <b>Once i execute the select statement its fetching only the Uppercase data. Here i need all the records with upper as well as lower case for 'good' as the string.</b>
<i>I am writing this in function mofdule and so it takes only uppercase search even if we give that in lower case.</i>
The statements highlighted sought of contradict each other..The best would be to paste the relevant part of code + examples with clear mention as to the data x should be fetched and not y etc...it would help to understand the requirement in a better way !!
2006 Oct 03 12:15 PM
Do like this.
data: ws_name1 like adrc-name1.
select name1 from adrc into ws_name1.
translate adrc-name1 to lower case.
update adrc.
endselect.
Regards,
PRakash.
2006 Oct 03 12:39 PM
Hi Anurag,
Let me eaplain this clearly.
I am building a function module to get the customer names. I have input field as Customer name and if i pass any search name here i need to get all the records form ADRC table which suits this match. For example i am giving search string as 'good'. But as the function module takes all the input parameters in Uppercase its giving only the uppercase data which suits the serach string 'good'. Here i need to fetch all the records(upper case and lower case) which contains 'good' in the customer name. Hope its clear now.
Regards,
Ram
2006 Oct 03 12:44 PM
Hi ram,
1. in r/3,
working with upper/lower case,
with database tables, is very tricky.
<b>(SIMPLY USING SQL WILL NOT
FETCH BOTH KIND OF DATA - UPPERCASE/lowercase/MIXED)</b>
2. For your requirement,
3.
a) just get ALL data from vendor master
(without any filteration of name)
in ITAB
b) LOOP AT ITAB.
IF ITAB-VENDORNAME CS 'GOOD'.
ELSE.
DELETE ITAB.
ENDLOOP.
4. After the step (b),
<b> itab will contain only GOOD vendors.
(irrespective of capital / lowercase) / mixedCASE</b>
regards,
amit m.
2006 Oct 03 12:46 PM
Hi Ram Mohan,
Try this, it is working for me.
1. Declare a range to hold the value.
2. Populate the range as follows. name1 is the function module parameter name
IF NOT name1 IS INITIAL.
rt_ernam-sign = 'I'.
rt_ernam-option = 'CP'.
rt_ernam-low = name1.
APPEND rt_ernam.
ENDIF.
Hope this helps.
2006 Oct 03 1:11 PM
Hi Imtiaz,
I am using the same but getting only Uppercase match. I need all the lower and uppercase records which match the pattern specified.
Regards,
Ram
2006 Oct 03 10:19 AM
hi,
us this.
transalate <field> to lower case.
similarly u can convert to upper case.
rgds
anver
pls mark hlpful answers
2006 Oct 03 10:20 AM
loop at <internal_table> into <work_area>.
TRANSLATE <work_area-field_name> to LOWER CASE.
MODIFY <table> from <work_area>.
endloop.
2006 Oct 03 10:23 AM
hi ram,
one way.
before inserting to db, u can convert the data to lower case.
rgds
anver
2006 Oct 03 1:54 PM
Use field MC_NAME1 instead of NAME1 in where condition.
NAME1 is converted to upper case and stored in MC_NAME1, but only first 25 chanracters of NAME1.
so convert user entered value to upper case and select fro adrc using MC_NAME1.
Try this code:
tables: adrc.
data: tadrc like adrc occurs 0 with header line.
select-options: s_mc1 for adrc-mc_name1.
select * from adrc into table tadrc where mc_name1 in s_mc1.
loop at tadrc.
write:/ tadrc-name1.
endloop.Regards
Sridhar
| User | Count |
|---|---|
| 6 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |