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

Help String Function To Upper

Former Member
0 Likes
1,504

Hi guys,

I want to edit a string by using a function like UpperCase or LowerCase. Is there any function in ABAP which has the same functionality?

next problem is:

Can i use this function in an SQL query?

Like: Select SINGLE IDSEGMENT

FROM Table

INTO IDSEG

WHERE Upcase(string1) = Upcase(string2).

Is this possible?

Problem is that in the DB the string1 is spelled different (capital letters) than string2

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,268

Hi,

Use the string comparision operator CS in your select query which is not case-sensistive.

Regards,

Vijay S

13 REPLIES 13
Read only

Former Member
0 Likes
1,268

Hi,

Try this out

*Code to demonstrate TRANSLATE to UPPER/LOWER CASE command

*----


DATA: ld_char(20) type c.

ld_char = 'Hello World'.

TRANSLATE ld_char TO UPPER CASE. "Result: ld_char = 'HELLO WORLD'

TRANSLATE ld_char TO LOWER CASE. "Result: ld_char = 'hello world'

See this link

http://help.sap.com/saphelp_46c/helpdata/en/fc/eb33a5358411d1829f0000e829fbfe/frameset.htm

Thanks & Regards,

Judith.

Read only

0 Likes
1,268

Thanks Judith,

but this was only my first problem,

any proposal for my second problem?

Read only

0 Likes
1,268

Hi Marcus,

Translate str to upper case.

Select SINGLE IDSEGMENT

FROM Table

INTO IDSEG

WHERE string = str.

Regards Andreas

Read only

0 Likes
1,268

Ok. But how can i translate the variable string?

I want both variables (str & string) to translate to upper case!

How about that?

Read only

0 Likes
1,268

Hi,

U cant use <b>Upcase</b>(string1) = <b>Upcase</b>(string2) in select query.

Can compare two strings thats all.Try removing that upcase and check.

Thanks & Regards,

Judith.

Read only

0 Likes
1,268

Thanks but how u would solve this problem?

Read only

0 Likes
1,268

Hi Marcus,

Select your database table data into an internal table and use the FIND command.

You can then use the ignoring case keyword.

If less than basis 6.1 you can use SEARCH (but may have to convert internal table to uppercase before searching).

Cheers,

Brad

Read only

0 Likes
1,268

Actually,

FIND doesn't really support internal tables, and SEARCH doesn't have IGNORING CASE.

So you'll have to make a trade off between looping through your internal table and using FIND, or translating the internal table to uppercase and using SEARCH.

I think I'd go for looping through your table and using FIND.

Brad

Read only

Former Member
0 Likes
1,269

Hi,

Use the string comparision operator CS in your select query which is not case-sensistive.

Regards,

Vijay S

Read only

0 Likes
1,268

Thank you all for ur answers.

I solved the problem with the solution from Vijayakrishnan.

Regards,

Marcus Pohl

Read only

0 Likes
1,268

Thank you all for ur answers.

But CS isn´t a valid comparison

Regards,

Marcus Pohl

Read only

0 Likes
1,268

Hi,

Try using LOWER(string1) = string

Also u can compare UPPER(string1) = String.

Like this convert anyone of teh string to the other and try it out.

Thanks & Regards,

Judith.

Read only

0 Likes
1,268

I didn't think so...

I think you are stuck with the internal table approach.

Brad